Twenty developers have cluster-admin on the production cluster. How do you tighten RBAC without blocking their work?
IntermediateScenarioSecurity incidents
Answer
Situation read → Developers mostly need read access and debugging in prod. Writes should go through the pipeline.
What I'd do →
- Check the audit logs to see what they actually do in prod over a month: mostly
get,logs,exec, occasionallyrollout restart. - Map groups from the IdP to Kubernetes RBAC (EKS access entries or aws-auth replacement), not individual users.
- Default role: namespaced read-only plus logs. Give a narrower "operator" role for on-call (
rollout restart, scale).
kind: Role
rules:
- apiGroups: [""]
resources: ["pods", "pods/log", "services", "configmaps", "events"]
verbs: ["get", "list", "watch"]
- apiGroups: ["apps"]
resources: ["deployments", "deployments/scale"]
verbs: ["get", "list", "patch"]
- Keep cluster-admin as break-glass only: time-limited, approved, and alerted on use.
- Make GitOps the write path, so most people never need write access in prod.
Why → Basing roles on real usage avoids both over-granting and the angry "I can't do my job" tickets.
Interview tip → Note that pods/exec is effectively a write permission; treat it as privileged.
More on Security incidents
An AWS access key for a production IAM user was pushed to a public GitHub repo 20 minutes ago. What do you do in the first 30 minutes?AdvancedYou find pods in your cluster running a crypto miner. What do you do?AdvancedA critical CVE is announced in a library you use. You have 200 images across 40 repos. How do you find and patch everything fast?IntermediateGuardDuty reports an EC2 instance talking to a known command-and-control IP. What do you do?AdvancedYou discover an S3 bucket with customer data has been public for three months. What now?IntermediateAn engineer left the company three weeks ago and you find their access key was used yesterday. How do you respond and fix the process?Beginner