How do you rotate a leaked ServiceAccount token?
IntermediateScenarioSecurity, RBAC and policy
Answer
Situation read → A token appeared in a public log.
What I'd do →
- Delete the affected Secret (legacy) or the ServiceAccount and recreate it
- Bound tokens expire, and you can restart pods to get new ones
- Check audit logs for use of the token
- Reduce its permissions
- Move to short-lived tokens with TokenRequest
Why → Revocation means invalidating the identity, not just removing the file.
Interview tip → Mention audit log queries by user.username.
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?IntermediateWhat does a ServiceAccount do and why should you disable the token automount?BeginnerHow 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?Advanced