Why do bound, projected service account tokens matter, and how do you use them?
IntermediateProductionKubernetes Security Posture
Answer
Since Kubernetes 1.24, pods receive short-lived tokens through the TokenRequest API, bound to the pod and an audience, instead of non-expiring Secret-based tokens. A stolen token expires and stops working when the pod is deleted.
For integrations that need a token for an external system, request a dedicated audience:
volumes:
- name: vault-token
projected:
sources:
- serviceAccountToken:
audience: vault
expirationSeconds: 600
path: token
Also find and remove legacy kubernetes.io/service-account-token Secrets; Kubernetes now labels unused ones and can clean them up automatically.
More on Kubernetes Security Posture
What is your security baseline for a new production EKS cluster?IntermediateDraw the layered security controls for workloads on Kubernetes.BeginnerHow do you assign Pod Security Admission levels across namespaces in production?BeginnerKyverno, OPA Gatekeeper or ValidatingAdmissionPolicy: how do you choose?IntermediateShow a ValidatingAdmissionPolicy that blocks containers without resource limits.AdvancedHow do you roll out default-deny NetworkPolicies in a running production cluster?Intermediate