Search⌘ K

Creating Cluster Role Bindings

Explore how to define and implement ClusterRoleBindings in Kubernetes to grant users view permissions across the entire cluster. Understand the differences between RoleBinding and ClusterRoleBinding and how to manage access securely. This lesson helps you enable controlled permissions for developers to safely build and test within the cluster.

View access across the cluster

We’ll change John’s view permissions so that they are applied across the whole cluster.

Instead of executing yet another ad-hoc kubectl commands, we’ll define the ClusterRoleBinding resource in YAML format so that the change is documented.

Looking into the definition

Let’s look at the definition in the crb-view.yml file:

YAML
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: view
subjects:
- kind: User
name: jdoe
apiGroup: rbac.authorization.k8s.io
roleRef:
kind: ClusterRole
name: view
apiGroup: rbac.authorization.k8s.io
...