That would be a Constitutional crisis.
In Bob Woodward's books Rage, Peril, and War, he reported that General Mark Milley, Trump's Chairman of the Joint Chiefs of Staff during his first presidency, made what he called an "oath" with the other service chiefs to prevent Trump from starting a war with Iran during his final days in office, after January 6th, 2021. Technically, the CJCS and officers are advisors only and have no actual control of the military, but Milley's plan was to exploit gaps between what's legal and what happens in reality. He knew that any major military actions had to come through him, and if he said "no," it would gum up the works even if it's not legal.
The CJCS and their officers all take an oath to the Constitution, not the president; the same is true for all officers and enlisted personnel in the military. We can only hope they'd honor that oath.