Kubernetes security & RBAC

ServiceAccounts, Roles vs ClusterRoles, Pod Security Standards, NetworkPolicies, image scanning and admission control. The gap between "it runs" and "it ships".

About 22 min read3-question knowledge check

The mental model

Think of a Kubernetes cluster as a corporate office building. Anyone can walk up to the front door (the API server), but a badge reader checks two things: who you are (authentication) and which rooms your badge opens (authorization — this is RBAC). Even with a valid badge, security at each floor can veto what you carry in (admission control — "no space heaters in the server room"), and internal doors between departments stay locked unless someone explicitly opens them (NetworkPolicies).

The critical mindset shift: workloads are employees too. Every Pod runs as a ServiceAccount, and by default that badge exists and gets mounted into the container whether the app needs it or not. Most real cluster compromises are not "someone hacked the API server" — they are "an app got popped, its ServiceAccount token was lying on the filesystem, and that token opened way too many doors."

RBAC is purely additive: there is no deny rule. You start from zero and grant. If two bindings overlap, the union applies. That makes reasoning simple — the question is always "what has been granted?", never "what has been blocked?"

The full lesson continues with 15 more sections
  • Deep dive
  • Internal architecture
  • Real-world use cases
  • Best practices
  • Common mistakes
  • Performance
  • Security
  • Production troubleshooting
  • Advantages & disadvantages
  • Alternatives
  • Interview expectations
  • Interview questions
  • Facts to remember
  • Cheat sheet
  • Quick revision