A Role grants permissions within a single namespace, while a ClusterRole grants permissions cluster-wide or across all namespaces. ClusterRoles are also required for non-namespaced resources like Nodes and PersistentVolumes.
RBAC Interview Questions
Why RBAC Matters in Interviews
RBAC is the gatekeeper of your Kubernetes cluster. Every API request passes through authentication and then authorization, and RBAC is the default authorizer. Interviewers use RBAC questions to test whether candidates can secure multi-tenant clusters and apply the principle of least privilege.
Expect questions that start with definitions ("What is the difference between a Role and a ClusterRole?") and progress to practical scenarios ("A developer says they cannot list Pods in the staging namespace — how do you troubleshoot this?"). More advanced interviews may present an overly permissive ClusterRoleBinding and ask you to identify the security risk and remediate it.
Candidates should be prepared to write RBAC manifests from scratch, explain how ServiceAccount tokens work (especially changes in Kubernetes 1.24+), and discuss strategies for auditing permissions across a cluster. Understanding how RBAC intersects with admission controllers and namespace isolation demonstrates the kind of layered security thinking that hiring teams value.
All Questions
A RoleBinding grants permissions within a specific namespace by binding a Role or ClusterRole to subjects. A ClusterRoleBinding grants permissions cluster-wide by binding a ClusterRole to subjects across all namespaces.
RBAC (Role-Based Access Control) is the standard authorization mechanism in Kubernetes. It lets you define fine-grained permissions by creating Roles that specify allowed API actions and binding them to users, groups, or ServiceAccounts.
Every namespace has a default ServiceAccount that is automatically assigned to Pods without an explicit serviceAccountName. If RBAC bindings are added to the default ServiceAccount, every Pod in that namespace inherits those permissions, creating an over-privileged attack surface.
You create a Role by defining rules that specify API groups, resources, and allowed verbs in a YAML manifest. You then create a RoleBinding that associates the Role with a subject (user, group, or ServiceAccount). Both can be created declaratively with YAML or imperatively with kubectl.
kubectl auth can-i checks whether a specific action is allowed by RBAC. You can test your own permissions or impersonate another user or ServiceAccount to verify their access. It is the primary CLI tool for RBAC debugging.
A ServiceAccount is an identity for processes running inside Pods. Kubernetes automatically mounts a token for the Pod's ServiceAccount, and RBAC bindings grant that ServiceAccount specific API permissions. Every namespace has a default ServiceAccount.
Least privilege means granting only the minimum RBAC permissions required for a subject to perform its function. This involves creating narrow Roles with specific verbs and resources, using namespace-scoped bindings, disabling unused ServiceAccount tokens, and regularly auditing permissions.
RBAC troubleshooting follows a systematic approach: verify the denial with kubectl auth can-i, check existing bindings and roles, inspect audit logs for the exact request, and fix the gap by creating or updating the appropriate Role and Binding.
Aggregated ClusterRoles use label selectors to automatically combine rules from multiple ClusterRoles into a single ClusterRole. Kubernetes built-in roles (admin, edit, view) use aggregation, allowing CRD authors to extend them without modifying the originals.
Kubernetes does not manage user accounts internally. Authentication is handled by external systems — X.509 client certificates, OIDC tokens, webhook token authentication, or cloud IAM. After authentication establishes identity, RBAC uses that identity (username and groups) to authorize API requests.
RBAC achieves namespace isolation by granting teams permissions only within their designated namespaces using namespace-scoped RoleBindings, avoiding ClusterRoleBindings, locking down the default ServiceAccount, and preventing cross-namespace resource access. Combined with NetworkPolicies and ResourceQuotas, this creates a multi-tenant boundary.