
Remember: Roles and role bindings are ideal for namespace-level access, while cluster roles and cluster role bindings extend permissions across the cluster.
Cluster Roles and Cluster Role Bindings
To authorize cluster-scoped resources, such as nodes and persistent volumes, you need to create cluster roles and cluster role bindings. Cluster roles function similarly to roles, but they are tailored for actions that span the entire cluster. For example, you can define a cluster administrator role that grants the ability to list, retrieve, create, and delete nodes. Alternatively, you might establish a storage administrator role to manage persistent volumes and persistent volume claims. Below is an example of a cluster role definition file namedcluster-admin-role.yaml. This YAML file defines a ClusterRole that grants administrative permissions on nodes:
cluster-administrator ClusterRole to a user named cluster-admin:
kubectl create command.
It’s important to note that while cluster roles and role bindings are primarily used for cluster-scoped resources, they can also manage access to namespace-scoped resources. When you bind a cluster role that grants permissions on pods, for instance, the user will have access to pods in every namespace—unlike a namespaced role which restricts access to a single namespace.
The following image further distinguishes how cluster roles work for both namespaced and cluster-scoped resources:

Kubernetes provides several default cluster roles when the cluster is initially set up. Be sure to review these defaults to understand the baseline permissions before creating custom roles.