ClusterRoleBindings grant the permissions defined in a ClusterRole to subjects (users, groups, or service accounts) across the entire cluster. They are the mechanism that connects ClusterRoles to the identities that need those permissions.Documentation Index
Fetch the complete documentation index at: https://docs.shiftlabs.dev/llms.txt
Use this file to discover all available pages before exploring further.
Key Concepts
ClusterRoleBinding
Role Reference
Subjects
System Binding
system:, cluster-admin, kubeadm:).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
How to View ClusterRoleBinding Details
How to Create a ClusterRoleBinding
Write YAML
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?
Can I bind a ClusterRole with a RoleBinding?
Can I bind a ClusterRole with a RoleBinding?
Why can't I change the roleRef?
Why can't I change the roleRef?
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?
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?
How do groups work in Kubernetes RBAC?
How do groups work in Kubernetes RBAC?
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?
Can a ServiceAccount be in a ClusterRoleBinding?
Can a ServiceAccount be in a ClusterRoleBinding?