What does a ServiceAccount do and why should you disable the token automount?
BeginnerScenarioSecurity, RBAC and policy
Answer
Situation read → Pods do not call the API but carry a token.
What I'd do →
- Set
automountServiceAccountToken: falseon pods or ServiceAccounts that do not need the API - Create dedicated ServiceAccounts per workload
- Check with
kubectl exec -- ls /var/run/secrets/kubernetes.io/serviceaccount - Use bound, projected tokens (default now)
- Do not use the
defaultServiceAccount for anything
Why → A token in a compromised pod is a foothold into the API server.
Interview tip → Mention bound tokens expire.
More on Security, RBAC and policy
A developer needs read-only access to one namespace. How do you grant it?BeginnerExplain the difference between Role, ClusterRole, RoleBinding and ClusterRoleBinding.IntermediateA CI pipeline needs to deploy to one namespace. What identity do you give it?IntermediateHow do you let pods on EKS access S3 without static keys?IntermediateA pod has access to the node's IAM role through IMDS. How do you prevent credential theft?AdvancedHow do you enforce a default-deny network posture in a namespace?Intermediate