Kubernetes ClusterRoleBinding is a Role-Based Access Control, or RBAC, object that grants a ClusterRole to one or more users, groups, or service accounts across the whole Kubernetes cluster. It connects “what actions are allowed” to “who can perform them” at cluster scope.
A ClusterRoleBinding gives subjects the permissions defined in a ClusterRole. Because it is cluster-scoped, the access applies across all namespaces when the ClusterRole contains rules for namespaced resources such as Pods, Deployments, or ConfigMaps.
It is commonly used for permissions that need to work beyond a single namespace, such as:
Kubernetes RBAC separates permissions into two parts:
get, list, watch, create, update, or delete.When a request reaches the Kubernetes API server, the RBAC authorizer checks the authenticated identity against RoleBindings and ClusterRoleBindings. If a matching binding grants the requested verb on the requested resource, Kubernetes allows the request.
User, Group, or ServiceAccount.rbac.authorization.k8s.io API group.The roleRef field is effectively fixed after creation. If you need to point the binding to a different role, delete and recreate the ClusterRoleBinding.
This example grants the built-in view ClusterRole to a service account named metrics-reader in the monitoring namespace:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: metrics-reader-view
subjects:
- kind: ServiceAccount
name: metrics-reader
namespace: monitoring
roleRef:
kind: ClusterRole
name: view
apiGroup: rbac.authorization.k8s.io
With this binding, the service account can read many common Kubernetes resources across namespaces, according to the rules in the view ClusterRole. It does not automatically receive permission to read Secrets unless the ClusterRole allows that.
You can test access with:
kubectl auth can-i list pods --all-namespaces \
--as=system:serviceaccount:monitoring:metrics-reader
A RoleBinding grants access inside one namespace. It can bind either a Role or a ClusterRole, but the access remains limited to that namespace.
A ClusterRoleBinding grants access at cluster scope. If the ClusterRole includes permissions for namespaced resources, those permissions apply in every namespace.
Use a RoleBinding when a team, service account, or application only needs access in one namespace. Use a ClusterRoleBinding when the subject truly needs cluster-wide access.
cluster-admin unless there is a clear operational need.ClusterRoleBindings are powerful because a small YAML change can grant access across the entire cluster. Treat them as security-sensitive configuration.
cluster-admin: This role gives broad control over the cluster and can bypass many intended boundaries.If the subject needs access in one namespace, use a RoleBinding. If the subject needs the same access across every namespace, or needs access to cluster-scoped resources such as Nodes, PersistentVolumes, or CustomResourceDefinitions, use a ClusterRoleBinding.
A ClusterRoleBinding does not define permissions by itself. It only grants the permissions already defined in a ClusterRole. A ClusterRole without a binding grants no access, and a binding that points to an overly broad ClusterRole can grant far more access than intended.