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

RoleBinding Fundamentals

Bind a Role to subjects within a namespace using RoleBinding objects.

RoleBinding Fundamentals

What you'll learn: How to connect a Role to users, groups, or service accounts within a namespace using RoleBinding objects.

The Missing Link

You've learned how to create a Role that defines permissions (like "can read pods" or "can create services"), but that Role by itself grants nothing. Think of a Role as a job description sitting on a desk—it defines what someone could do, but nobody has that job yet. A RoleBinding is the employment contract that actually assigns that job description to specific people.

How RoleBindings Work

A RoleBinding has three essential pieces:

  1. roleRef: Points to the Role you want to assign (the "what")
  2. subjects: Lists who receives those permissions (the "who")
  3. namespace: Where this binding applies (same namespace as the Role)

The roleRef is immutable once created—you cannot change which Role a RoleBinding points to. You must delete and recreate the binding to reference a different Role.

The subjects section can include:

  • Users: Individual human identities
  • Groups: Collections of users
  • ServiceAccounts: Pod identities within the cluster

The Namespace Boundary

RoleBindings operate only within their namespace. If you create a RoleBinding in the dev namespace that references a Role in dev, those permissions only apply to resources in the dev namespace—never in prod or any other namespace. This namespace isolation is a fundamental security feature.

One RoleBinding can assign the same Role to multiple subjects simultaneously, and one subject can have multiple RoleBindings granting different Roles.

Key Takeaway: A RoleBinding is the glue that connects a Role's permissions to specific subjects (users, groups, or service accounts) within a single namespace, making RBAC rules actually take effect.