Every developer has `cluster-admin` on the shared cluster "because it is easier". How do you fix RBAC without a revolt?
BeginnerScenarioKubernetes Security
Answer
Situation read → cluster-admin for everyone means any compromised laptop owns the cluster. Fix it gradually with good defaults.
What I'd do →
- Find who has it:
kubectl get clusterrolebindings -o wide | grep cluster-admin. - Create a namespaced
Rolefor app teams (deployments, services, configmaps, pods/log) and bind it per team namespace with aRoleBinding. - Give a cluster-wide read-only
ClusterRolefor visibility, excluding secrets. - Keep
cluster-adminfor a small platform group via JIT elevation. - Test with
kubectl auth can-i --list [email protected] -n ordersbefore removing old bindings.
Why → Teams keep full control of their own namespaces, so daily work does not change.
Interview tip → kubectl auth can-i shows you verify RBAC rather than guess.
More on Kubernetes Security
What are the 4Cs of cloud native security?BeginnerWhat happens to a request between `kubectl apply` and etcd from a security point of view?IntermediateExplain Role, ClusterRole, RoleBinding and ClusterRoleBinding.BeginnerHow do you check what a user or service account is allowed to do?BeginnerWhich RBAC permissions are effectively cluster-admin in disguise?AdvancedHow do service account tokens work now, and what is `automountServiceAccountToken`?Intermediate