A developer needs read-only access to one namespace. How do you grant it?
BeginnerScenarioSecurity, RBAC and policy
Answer
Situation read → A new joiner should view pods and logs in staging only.
What I'd do →
- Use the built-in
viewClusterRole bound with a RoleBinding:kubectl create rolebinding dev-view --clusterrole=view [email protected] -n staging - Bind groups rather than users when using SSO
- Test with
kubectl auth can-i list pods -n staging --as [email protected] - Confirm secrets are not readable:
can-i get secrets - On EKS map IAM identities with access entries
Why → A RoleBinding scopes a ClusterRole to a single namespace.
Interview tip → Say least privilege and group-based bindings.
More on Security, RBAC and policy
Explain 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?AdvancedHow do you enforce a default-deny network posture in a namespace?Intermediate