By not sucking. Don't suck and you won't get "cut." Also, don't be a douchebag. The Navy/ Marine Corps has a wonderful system for getting rid of dudes that no one wants to hang out with in the ready room.
Not sucking can help, but it can also work against you. I know a guy who was a #1 EP out of the weapons school, #1 out of his flying shore tour (a very sought after position), and basically got sent to the leper colony for wanting to go fight in the war instead of doing what the commodore wanted him to do (follow the path). You would think that a guy who had been a top performer for 6+ years in the fleet and beyond would earn him the right to get back into the war if that was what he wanted. Think again.
We can all feel like we have job security, but the reality is that we are all one shitty fitrep (or BUPERS decision) away from dusting off our resume.
Being good at your job is important. Knowing when you have to play ball is important, and having good relationships with those who will be in a position to help you is of highest importance. It's not just what you know, but who you know, and hopefully those folks don't think you are an asshole. (not that the guy from my story was an asshole..quite the opposite)