In an ideal world we'd all have a boss who means what they say and says what they mean. They would be someone who represents professional integrity, competence and that you genuinely respect. Their goal would be to ensure that work decisions are made based on the interests of the company instead of working their agenda.
But, if you have ever had a bad boss or worked in a company that's highly political... It goes with out saying that you need to stop day dreaming. Poor leadership is often one of the top reasons someone leaves a company. Each time I left a company in my 20s has been due to my inability to be realistic and manage up based on the cold hard reality that work is more like Office Space than our younger selves would have cared to admit. Remember it's GOT in the corporate world. Be observant, play social chess. Don't be Ned Stark, your best intentions and lack of EQ will kill ya.
Work at the end of the day is work and while you may have your own personal ethics, integrity or preferred style - if you want to have an enjoyable work life you need to know how to manage your standards in the context of a boss. Since this is an initial post on the topic I thought I'd offer my insight based on my cold hard experience.
1. Don't take anything your boss says at face value. More often than not they are often just fishing for info to determine if you are a cog or someone who could cause trouble or be a threat to their agenda. Don't be Sponge Bob or Patrick, be Bojack Horseman with a Sponge Bob mask. Seem harmless so you understand the lay of the land.
It is rare that what they say is honest, if it is you'll know and you probably wouldn't find yourself reading an article about managing up because your boss is a supportive dream you'd never leave. They'd understand if they train you, provide support and delegate you'll be loyal, reliable and a value add to their team's abilities.
2. Understand what your boss's priorities are so you can frame what you say to them and do for them in that context. Make sure it sounds safe to them based on who they are (that you aren't threatening their position) and it is relevant so they don't get irritated with your inability to be concise and precise. Basically treat them like they are your target audience and every communication you have with them is an ad.
3. Make them look good and make sure you make their life easier but don't steal their thunder.
4. Make sure they trust you.
5. To build rapport take on responsibilities that enable you to grow but that don't step on the toes of your boss.
6. If they have failed to delegate properly in the past try to get this failure by digitalizing communications. Send them written summaries of what was discussed with timelines. This only helps though if your company holds them accountable for competency. If they consistently use you as a scapegoat and you can't use the truth to illustrate their incompetence do one thing... Run.
Those are what I have found to be effective for ensuring I have a good working relationship. Once you have credibility with your boss you will get more support and buy in for the projects you want to see happen in your work place. Just tell your priorities through their context. Be a smart little shit but keep it low key.
This one is more for the imagination since I can't think of anyone I would want to do it to, but maybe you have a truly incompetent boss who has made you miserable due to their Grinch-like heart. Allow yourself to be the smaller person but be smart about it. Insincerity is an art form that should be returned. Just make sure you don't need a bridge and when it burns it is a low simmer.
When you are in a calm and collected mindset use what you understand about who they are to teach them a few lessons before you go. Play dumb, do something they can't call you out on, 'accidentally' roadblock, irritate their pet peeves. If they have made your life intentionally miserable, it is only karma to give a gift of giving back. Just be smart about it or that rotten egg will break on your head instead of theirs.