Former U.S. Navy SEAL Jocko Willink understands what it's like to have a bad boss. He's had his share but was also a micromanager himself on the battlefield, he explains in his new book "The Dichotomy of Leadership." Given his unique perspective, Willink offers one key piece of advice: Don't focus on what you wish you could change about your boss. Instead, focus on being your boss's ally. "Great boss or horrible boss, my goal is to have a great relationship with [that person]," says Willink to CNBC Make It. Here is Willink's advice on how to build a better relationship with three types of difficult bosses.

If your boss is a micromanager

Micromanagers will try to control your every thought and action. Bosses who do this likely have a trust issue, explains Willink. When he found himself with a micromanaging boss, Willink had a straightforward strategy: he did exactly what his boss asked. He gave that boss all the information that was asked for and more. "I'm going to give them the most detailed report of everything that I'm doing so that they realize: Yes, I am engaged. Yes, I am walking a good path. And yes, they can begin to trust me." Eventually, Willink said his boss would look at him and say, "Hey, you don't need to give me all this information. Go out. I trust you. Do what you have to do."

If your boss is an egomaniac

Defensive bosses who won't take ownership for their decisions might be insecure. With these managers, Willink suggests you massage their egos. Make them realize that you respect them. "Make them feel good," he says. With these types of leaders, it's critical to make it clear that you aren't looking to take credit from them. You'll build a better relationship with your boss by ultimately proving that you're "actually there to make them look good."

If your boss is too laid back