Explain the difference between Role, ClusterRole, RoleBinding and ClusterRoleBinding.
IntermediateScenarioSecurity, RBAC and policy
Answer
Situation read → An audit finds a ClusterRoleBinding where a RoleBinding was intended.
What I'd do →
- Role grants permissions inside a namespace
- ClusterRole grants cluster-wide or can be reused across namespaces
- RoleBinding grants a Role or ClusterRole within one namespace
- ClusterRoleBinding grants cluster-wide
- Audit with
kubectl get clusterrolebindings -o wideandkubectl who-can/rbac-tool
Why → Binding scope decides how far the permissions reach, not the role kind.
Interview tip → Mention aggregated ClusterRoles.
More on Security, RBAC and policy
A developer needs read-only access to one namespace. How do you grant it?BeginnerA 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