Key Concepts
ClusterRoleBinding
A cluster-scoped binding that grants ClusterRole permissions to subjects across all namespaces.
Role Reference
The ClusterRole whose permissions are being granted by this binding.
Subjects
The users, groups, or service accounts receiving the permissions.
System Binding
Built-in bindings managed by Kubernetes (prefixed with
system:, cluster-admin, kubeadm:).ClusterRoleBindings are cluster-scoped resources. They grant permissions across all namespaces, unlike RoleBindings which are namespace-scoped.
Required Permissions
| Action | Permission |
|---|---|
| View ClusterRoleBindings | iam:project:infrastructure:kubernetes:read |
| Create ClusterRoleBinding | iam:project:infrastructure:kubernetes:write |
| Edit ClusterRoleBinding | iam:project:infrastructure:kubernetes:write |
| Delete ClusterRoleBinding | iam:project:infrastructure:kubernetes:delete |
Binding Types
| Type | Description |
|---|---|
| System | Built-in Kubernetes bindings (cannot be deleted) |
| Custom | User-created bindings |
Subject Types
| Type | Description |
|---|---|
| User | A human user authenticated to the cluster |
| Group | A collection of users (e.g., system:masters) |
| ServiceAccount | A Kubernetes service account for pods |
How to View ClusterRoleBindings
View List
The list shows all ClusterRoleBindings in the cluster (cluster-scoped, no namespace filter).
How to View ClusterRoleBinding Details
How to Create a ClusterRoleBinding
Write YAML
Enter the ClusterRoleBinding manifest in YAML format. Key fields:
roleRef- Reference to the ClusterRole to bindsubjects- List of users, groups, or service accounts
How to Edit a ClusterRoleBinding
How to Delete a ClusterRoleBinding
Example ClusterRoleBindings
Grant Cluster Admin to User
Grant Read Access to Group
Grant Permissions to ServiceAccount
Multiple Subjects
Subject Reference Format
| Field | Description |
|---|---|
| kind | Type of subject: User, Group, or ServiceAccount |
| name | Name of the user, group, or service account |
| namespace | Required for ServiceAccounts, empty for Users/Groups |
| apiGroup | rbac.authorization.k8s.io for Users/Groups, empty for ServiceAccounts |
Common System Bindings
| Binding | Role | Description |
|---|---|---|
| cluster-admin | cluster-admin | Super-user access (system:masters group) |
| system:node | system:node | Permissions for kubelets |
| system:kube-scheduler | system:kube-scheduler | Scheduler permissions |
| system:kube-controller-manager | system:kube-controller-manager | Controller manager permissions |
Troubleshooting
User cannot access resources
User cannot access resources
- Verify a ClusterRoleBinding exists for the user
- Check the subject name matches exactly (case-sensitive)
- Verify the ClusterRole has the needed permissions
- Use
kubectl auth can-i --as=<user>to test permissions - Check for typos in user/group names
ServiceAccount permissions not working
ServiceAccount permissions not working
- Verify the namespace is specified in the subject
- Check the ServiceAccount exists in that namespace
- Ensure pods are using the correct ServiceAccount
- Verify the ClusterRoleBinding is cluster-scoped (not RoleBinding)
Cannot delete ClusterRoleBinding
Cannot delete ClusterRoleBinding
- System bindings cannot be deleted
- Verify you have delete permission
- Check for finalizers blocking deletion
Changes not taking effect
Changes not taking effect
- RBAC changes are immediate
- Clear any client-side caching
- Verify the binding was actually updated
- Check if there are conflicting bindings
Cannot change roleRef
Cannot change roleRef
- roleRef is immutable after creation
- Delete the binding and create a new one
- This is by design to prevent privilege escalation
FAQ
What is the difference between ClusterRoleBinding and RoleBinding?
What is the difference between ClusterRoleBinding and RoleBinding?
ClusterRoleBinding grants permissions cluster-wide across all namespaces.RoleBinding grants permissions only within a single namespace, even if it references a ClusterRole.
Can I bind a ClusterRole with a RoleBinding?
Can I bind a ClusterRole with a RoleBinding?
Yes. A RoleBinding can reference a ClusterRole, but permissions are limited to the RoleBinding’s namespace. This is useful for reusing common roles across namespaces without granting cluster-wide access.
Why can't I change the roleRef?
Why can't I change the roleRef?
The
roleRef is immutable to prevent privilege escalation. If you could change it, you could escalate permissions without delete access. To change the role, delete and recreate the binding.How do I grant admin access to a user?
How do I grant admin access to a user?
Create a ClusterRoleBinding that binds the user to the
cluster-admin ClusterRole. Be cautious - this grants full access to everything in the cluster.Can multiple bindings reference the same role?
Can multiple bindings reference the same role?
Yes. You can have multiple ClusterRoleBindings referencing the same ClusterRole, each with different subjects. Permissions are additive.
How do groups work in Kubernetes RBAC?
How do groups work in Kubernetes RBAC?
Groups are provided by your authentication system (OIDC, certificates, etc.). Kubernetes doesn’t manage groups - it trusts the authenticator. Common groups include
system:masters (cluster-admin) and system:authenticated (all authenticated users).What happens when I delete a user's binding?
What happens when I delete a user's binding?
The user immediately loses the permissions granted by that binding. If they have other bindings, those permissions remain. RBAC changes take effect instantly.
Can a ServiceAccount be in a ClusterRoleBinding?
Can a ServiceAccount be in a ClusterRoleBinding?
Yes. ServiceAccounts can be subjects in ClusterRoleBindings, granting them cluster-wide permissions. Always specify the namespace where the ServiceAccount exists.