Secession is neither legal or illegal. The USC is totally silent(Still after all these years and a Civil War) on the subject. The right to leave the Union is not something can or should be codified, it is unspoken natural right.
IMO each state should have to vote EVERY YEAR to stay in the Union, the default would be sovereignty.
The 10th Amendment makes that natural right a legal right. We just need the power to protect that right in the fact of opposition from the thug in our White House.