liveBook · Manning

Cluster role binding

As explained in Acing the Certified Kubernetes Administrator Exam, Second Edition

A ClusterRoleBinding is a Kubernetes API object that grants the permissions of a ClusterRole to specified subjects across the cluster.

A ClusterRoleBinding grants a ClusterRole’s permissions to specified users, groups, or Service Accounts across the cluster. RBAC uses the binding when deciding whether a subject may perform a requested action on the Kubernetes API. section 3.1 section 9.3.2

Choose the binding by the scope of access needed:

  • Use a RoleBinding for permissions confined to a namespace. It can reference a Role or a ClusterRole. section 3.1.1
  • Use a ClusterRoleBinding to grant a ClusterRole across the cluster. It cannot reference a namespaced Role. section 3.1.1 section 3.4

Grant and check cluster-wide viewing

Run `kubectl create clusterrolebinding audit-view --clusterrole=view --user=auditor`, then inspect it with `kubectl get clusterrolebinding audit-view -o yaml`. Check the resulting access with `kubectl auth can-i get pods -n default --as=auditor` and repeat the check in another namespace. The built-in `view` ClusterRole excludes Secrets; other bindings may still grant the user additional access. section 3.1.2 section 3.1.1

kubectl get clusterrolebinding kubeadm:cluster-admins -o yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  creationTimestamp: "2025-09-02T19:09:30Z"
  name: kubeadm:cluster-admins
  resourceVersion: "241"
  uid: 4b7e6cba-c951-431e-af88-32958326de97
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
- apiGroup: rbac.authorization.k8s.io
  kind: Group
  name: kubeadm:cluster-admins

Inspect an existing ClusterRoleBinding manifest: `roleRef` names the `cluster-admin` ClusterRole, while `subjects` names the group receiving its permissions. The `cluster-admin` role has full access, so check the subject before assigning it. section 3.1.2

Some default ClusterRoleBindings are managed by the control plane. The API server can restore missing subjects in those bindings, so inspect an existing binding before treating it as a permanent manual change. section 3.1.2

How Acing the Certified Kubernetes Administrator Exam, Second Edition covers it

How deep it goes
Explains binding scope, supported role references, manifest fields, and permission checks without descending into authorization internals.
Examples
Shows cluster-admin bindings to groups and uses kubectl auth can-i to check permissions.
What it assumes
Builds on users, groups, Service Accounts, and the distinction between namespaced and cluster-scoped resources.
What you can do after
Operate/configure it with kubectl, inspect its ClusterRole and subjects, and verify access with kubectl auth can-i.
How it connects
Connects ClusterRoleBindings to RBAC, ClusterRoles, RoleBindings, namespace scope, and Service Accounts.

Also explained in

Compare how 4 books explain cluster role binding →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Acing the Certified Kubernetes Administrator Exam, Second Edition. The section links point to the parts of the book it draws on.