What is rbac in kubernetes

Last updated: April 1, 2026

Quick Answer: RBAC (Role-Based Access Control) is a Kubernetes security feature that manages user and service account permissions. It uses roles and role bindings to define who can access specific resources and what actions they can perform.

Key Facts

What is RBAC in Kubernetes?

RBAC (Role-Based Access Control) is a Kubernetes security feature that controls who can access what resources and perform which actions within a cluster. It's essential for securing multi-tenant Kubernetes environments and ensuring that users and applications only have the permissions they need.

Core RBAC Components

RBAC consists of four main components: Role (defines permissions in a namespace), ClusterRole (defines cluster-wide permissions), RoleBinding (grants Role permissions to users/service accounts in a namespace), and ClusterRoleBinding (grants ClusterRole permissions cluster-wide). Together, these components create a comprehensive permission system.

How RBAC Works

When a user or pod attempts to access a Kubernetes resource, the API server checks RBAC policies. The request includes the user identity, requested resource, and desired action (verb). The system verifies if a RoleBinding or ClusterRoleBinding grants the necessary permissions. If no matching role grants access, the request is denied.

Roles and Permissions

Roles define specific permissions using rules that specify resources, API groups, and verbs. Common verbs include get, list, create, update, patch, delete, and watch. For example, a role might grant permissions to get and list pods, but not delete them. ClusterRoles work identically but apply cluster-wide rather than to a single namespace.

Service Accounts and RBAC

Service accounts are Kubernetes identities used by pods to authenticate with the API server. Each pod automatically mounts a service account token. By binding roles to service accounts, you control what each pod can access. This is critical for least-privilege access, ensuring applications only access necessary resources.

Related Questions

What is a Kubernetes service account?

A service account is a Kubernetes identity for applications and pods to authenticate with the API server. Each namespace has a default service account, and additional ones can be created.

What is the difference between Role and ClusterRole in Kubernetes?

Roles are namespaced and apply to resources within a specific namespace, while ClusterRoles are cluster-wide and can reference cluster-level resources like nodes.

How do I create a Kubernetes role?

Create a Role using a YAML manifest specifying rules with apiGroups, resources, and verbs. Apply it with kubectl apply -f, then bind it to users or service accounts with RoleBinding.

Sources

  1. Kubernetes Official Documentation - RBAC CC-BY-4.0
  2. Wikipedia - Role-Based Access Control CC-BY-SA-4.0