Authentication proves who is making a request. Authorization decides what they can do. In Kubernetes, these are separate subsystems that run in sequence on every API request.
Kubernetes Authentication Methods
- Service Account Tokens: Projected tokens for pods (auto-mounted by default). Short-lived since K8s 1.24.
- OIDC: External identity providers (Okta, Auth0, Dex) for human users. Recommended for developer access.
- X.509 Client Certificates: Certificate-based auth for system components and CI/CD. Hard to revoke.
- Webhook Token Authentication: Custom auth server for specialized flows.
RBAC Design Principles
# Principle 1: Namespace-scoped Roles over ClusterRoles
# Principle 2: Bind to specific ServiceAccounts, not groups
# Principle 3: Use verb restrictions (get,list vs create,delete)
# Principle 4: Audit with: kubectl auth can-i --list --as=system:serviceaccount:ns:sa
Identity in Distributed Systems
Kubernetes service accounts provide in-cluster identity. But what about services communicating across clusters? Or between Kubernetes and VMs? This is where SPIFFE (Module 6) bridges the gap — providing portable, cryptographic workload identity beyond Kubernetes boundaries.