Course contentsShow
← Cloud and Infrastructure
Lesson 1383 of 2,98928. Kubernetes SecurityFree lesson

ClusterRoleBinding Usage

Grant cluster-wide permissions by binding ClusterRoles to subjects with ClusterRoleBinding.

ClusterRoleBinding Usage

What you'll learn: How to grant cluster-wide permissions by connecting ClusterRoles to users, groups, or service accounts using ClusterRoleBindings.

The Core Concept

In the previous lesson, you created a ClusterRole—a template of permissions that applies across your entire Kubernetes cluster. But a ClusterRole by itself grants nothing. You need a ClusterRoleBinding to actually attach those permissions to subjects (users, groups, or service accounts).

Think of it like this: a ClusterRole is a master key design, and a ClusterRoleBinding is the act of handing that key to specific people. Without the binding, the key just sits in a drawer unused.

How ClusterRoleBinding Works

A ClusterRoleBinding has two essential parts:

  1. roleRef — Points to the ClusterRole you want to use (the permission template)
  2. subjects — Lists who gets those permissions (users, groups, or service accounts)

Unlike RoleBindings (which are namespaced), ClusterRoleBindings operate cluster-wide. When you bind a ClusterRole via ClusterRoleBinding, those subjects gain permissions across all namespaces and cluster-scoped resources.

Structure Overview

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: read-pods-global
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: pod-reader-cluster
subjects:
- kind: User
  name: jane@example.com
  apiGroup: rbac.authorization.k8s.io

This binding grants user jane@example.com the permissions defined in the pod-reader-cluster ClusterRole across the entire cluster.

Key Takeaway: ClusterRoleBindings connect ClusterRoles to subjects, granting cluster-wide permissions—use them carefully since they affect all namespaces and cluster resources.