Manage Kubernetes ClusterRoleBindings to grant cluster-wide permissions to users, groups, and service accounts
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.
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?
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?
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?
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?
Yes. You can have multiple ClusterRoleBindings referencing the same ClusterRole, each with different subjects. Permissions are additive.
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?
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?
Yes. ServiceAccounts can be subjects in ClusterRoleBindings, granting them cluster-wide permissions. Always specify the namespace where the ServiceAccount exists.