A CI pipeline needs to deploy to one namespace. What identity do you give it?
IntermediateScenarioSecurity, RBAC and policy
Answer
Situation read → The pipeline currently uses a cluster-admin kubeconfig.
What I'd do →
- Create a ServiceAccount
ci-deployerin the namespace - Grant a Role limited to deployments, services, configmaps with verbs get, list, create, update, patch
- Use short-lived tokens through OIDC federation (GitHub Actions to IAM to EKS) rather than long-lived secrets
- Verify with
kubectl auth can-i --list --as system:serviceaccount:app:ci-deployer -n app - Rotate and audit
Why → Short-lived, scoped credentials limit damage when a pipeline is compromised.
Interview tip → Say never cluster-admin in CI.
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.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?AdvancedHow do you enforce a default-deny network posture in a namespace?Intermediate