Kubernetes RBAC (role-based access control) decides who can do what through the Kubernetes API. You write the "what" in a Role, and a RoleBinding gives that Role to a user, a group or a ServiceAccount. 5 things to know before you hand out access:
Bottom line
- Role = what. Binding = who. A Role alone grants nothing. A binding alone grants nothing
- RBAC only adds. There are no deny rules. To take access away, you find the binding that grants it and remove it
- The binding decides the reach. A ClusterRole bound with a RoleBinding works in 1 namespace. The same ClusterRole bound with a ClusterRoleBinding works everywhere
- "Read only" is NOT harmless. list on Secrets returns every Secret value. get on nodes/proxy can run commands in Pods
- Some permissions lead to more permissions. create Pods, bind, escalate, impersonate. Review who holds those first
A Role that reads Pods and their logs in 1 namespace, and the binding that gives it to a user, on Kubernetes v1.37:
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
namespace: dev
name: pod-reader
rules:
- apiGroups: [""]
resources: ["pods", "pods/log"]
verbs: ["get", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
namespace: dev
name: read-pods
subjects:
- kind: User
name: jane
apiGroup: rbac.authorization.k8s.io
roleRef:
kind: Role
name: pod-reader
apiGroup: rbac.authorization.k8s.io(A user keeps the example short. In a real cluster the subject would be a group.)
The 5 commands you will use most:
kubectl auth whoami
kubectl auth can-i list pods -n dev
kubectl auth can-i --list -n dev
kubectl auth can-i list pods -n dev --as=jane
kubectl get rolebindings,clusterrolebindings -A -o wideEverybody is cluster-admin and nobody remembers why? Get a free DevOps assessment: a senior engineer reviews your CI/CD, infra, Kubernetes, cloud cost and on-call setup.
Find your situation:
- You are new to the 4 objects: Role, ClusterRole, RoleBinding, ClusterRoleBinding
- You mix up Role and ClusterRole: the binding decides the reach
- You are writing rules: apiGroups, resources, verbs
- An app needs API access: give a ServiceAccount permissions
- You got a Forbidden error: how to read it and what to check first
- You are reviewing a cluster: permissions that lead to more permissions
- You are on a managed cluster: EKS, GKE and AKS
What Kubernetes RBAC is, and where it sits in a request
Every write to the Kubernetes API passes 3 gates, in this order. Reads stop after the second:
- Authentication: who are you? A request with bad credentials gets HTTP 401. A request with no credentials at all usually becomes the user
system:anonymousand is refused at the next gate - Authorization: may you do this? RBAC lives here. A request that fails here gets HTTP 403 (Forbidden)
- Admission control: is the object acceptable? Admission controllers see the content of the object, which authorizers do not. They run on create, update, delete and connect requests only
RBAC answers 1 question: may this subject do this verb on this resource.

That question is narrower than it sounds. The authorizer sees the user, the groups, the verb, the API group, the resource, the subresource, the namespace and the object name. It does not see the body of the request. So RBAC can say "jane may create Pods in dev". It cannot say "jane may create Pods in dev unless they are privileged". That second sentence is a job for admission control.
RBAC is one of 6 authorization modes: AlwaysAllow, AlwaysDeny, ABAC, RBAC, Node and Webhook. A cluster can run several. Each one is asked in order, and the first to approve or deny decides. If none of them has an opinion, the request is denied.
(A detail that surprises people: a bare kube-apiserver defaults to AlwaysAllow. RBAC is on in your cluster because the installer turned it on. kubeadm sets Node,RBAC.)
Role, ClusterRole, RoleBinding, ClusterRoleBinding
RBAC has 4 kinds of object, all in the rbac.authorization.k8s.io API group:
| Object | Scope | What it holds |
|---|---|---|
| Role | Namespaced | Rules for resources in its namespace |
| ClusterRole | Cluster scoped | Rules for any namespace, for cluster scoped resources (nodes) and for non-resource URLs (/healthz) |
| RoleBinding | Namespaced | Subjects plus a reference to 1 Role or ClusterRole. Grants it in its own namespace |
| ClusterRoleBinding | Cluster scoped | Subjects plus a reference to 1 ClusterRole. Grants it in every namespace |
A binding has 2 parts: subjects (who) and roleRef (which role).
A Role alone grants nothing. A binding alone grants nothing.

3 rules that explain most of RBAC's behavior:
- Permissions are purely additive. There are no deny rules. A subject's access is the sum of every role bound to it, to its groups, and to everybody
- The default is deny. No matching rule means no access
- roleRef cannot be changed. To point a binding at another role, you delete it and create a new one. You can still edit the subjects
The first rule has a consequence that is easy to miss: you cannot fix an over-permissive ClusterRoleBinding by adding a tighter RoleBinding next to it. The wide one still applies. You have to delete it.
The third rule is deliberate. It lets you give someone update on a binding so they can manage its members, without letting them swap the role underneath. If you manage RBAC from files, kubectl auth reconcile handles the delete and recreate for you. The kubectl reference prefers it to kubectl apply for RBAC objects:
kubectl auth reconcile -f rbac.yaml \
--remove-extra-permissions \
--remove-extra-subjectsWithout those 2 flags, reconcile only adds. A rule or a subject that you deleted from the file stays in the cluster. And it never deletes a whole Role or binding that you removed from the file. That part is still yours.
Role vs ClusterRole: the binding decides the reach
The names suggest that a Role is for a namespace and a ClusterRole is for the cluster. Half true. A ClusterRole is a set of rules that lives outside any namespace. Where those rules apply depends on the binding:
| Role kind | Bound with | Result |
|---|---|---|
| Role | RoleBinding | Access in 1 namespace |
| ClusterRole | RoleBinding | The ClusterRole's rules, in the namespace of the RoleBinding only |
| ClusterRole | ClusterRoleBinding | Access in every namespace, plus cluster scoped resources |
| Role | ClusterRoleBinding | Not possible. A ClusterRoleBinding can only reference a ClusterRole |
The binding decides where a ClusterRole applies.

The second row is the one to remember. It lets you define a role once and reuse it in 40 namespaces, with 1 small RoleBinding in each. That is how the built-in admin, edit and view roles are meant to be used:
kubectl create rolebinding jane-view \
--clusterrole=view \
--user=jane \
--namespace=devjane can now read most objects in dev, and this binding gives her nothing anywhere else.
2 things only a ClusterRole with a ClusterRoleBinding can grant:
- Cluster scoped resources: nodes, PersistentVolumes, ClusterRoles themselves, the list of all namespaces. A rule for
nodesbehind a RoleBinding does nothing. (A RoleBinding does reach 1 cluster scoped object: its own Namespace.) - Non-resource URLs:
/healthz,/metricsand friends. The API rejects a Role that containsnonResourceURLs
My default: write ClusterRoles for anything reusable, bind them with RoleBindings, and treat every ClusterRoleBinding as something that needs a reason. For how to split a cluster into namespaces in the first place, see the Kubernetes namespace guide.
How to write a rule: apiGroups, resources, verbs
A rule for resources has 3 parts you always write and 1 optional part:
rules:
- apiGroups: ["apps"]
resources: ["deployments", "deployments/scale"]
verbs: ["get", "patch"]
resourceNames: ["web"] # optional- apiGroups: the API group of the resource.
""is the core group (Pods, Services, Secrets, ConfigMaps). Deployments are inapps, Ingresses innetworking.k8s.io - resources: the plural name as it appears in the API URL:
pods,deployments. A subresource is written with a slash:pods/log,pods/exec,deployments/scale - verbs: get, list, watch, create, update, patch, delete, deletecollection
- resourceNames: limits the rule to named objects
(A ClusterRole rule for non-resource URLs is the exception: it has nonResourceURLs and verbs, and nothing else.)
You do not have to guess the names. This prints every resource with its API group, whether it is namespaced, and the verbs it supports:
kubectl api-resources -o wideIt does not list subresources. Those you take from the docs or from the Forbidden error.
4 traps in rules:
- Subresources are separate.
getonpodsdoes not give you logs or exec. Logs needpods/log.kubectl execneedscreateonpods/exec - get, list and watch give the same data. All 3 can return the full object. "list only" is not a weaker form of read
- The wildcard is a blank check on the future.
*covers resources, subresources and verbs that get added to the cluster later, including every CRD someone installs next year - resourceNames has holes. It cannot restrict
createon a top-level resource (the name is not known yet) ordeletecollection. And alistrestricted by name only works when the client asks for exactly that name
The last one causes a confusing failure. Say a Role allows get and list on the ConfigMap named my-configmap. This fails with Forbidden:
kubectl get configmapsAnd this works:
kubectl get configmaps --field-selector=metadata.name=my-configmapRBAC does not filter the list for you. It allows or refuses the whole request.
Besides the 8 standard verbs there are a few special ones. You will meet 3 of them later in this article: bind and escalate (on roles and clusterroles) and impersonate (on users, groups and serviceaccounts).
Users, groups and ServiceAccounts: who a binding can name
A binding can name 3 kinds of subject:
subjects:
- kind: User
name: jane
apiGroup: rbac.authorization.k8s.io
- kind: Group
name: platform-team
apiGroup: rbac.authorization.k8s.io
- kind: ServiceAccount
name: ci-deployer
namespace: ci(A ServiceAccount subject takes a namespace and no apiGroup. The API rejects a ServiceAccount subject that carries the apiGroup line of a User.)
Kubernetes has no User object. You cannot kubectl get users. A user name is a string that the authentication layer hands to the API server: the common name of a client certificate, a claim from your OIDC provider, an IAM identity on a managed cluster. Groups work the same way. With client certificates, the organization fields become the groups.
That has 2 consequences:
- RBAC does not check that a subject exists. A binding for
jnaeis accepted and does nothing - If a user is deleted in your identity provider and someone later gets the same name, they inherit every binding that still mentions it. This is why stale bindings matter
ServiceAccounts are real objects, and each one also has a user name and groups:
| Name | Who it is |
|---|---|
system:serviceaccount:ci:ci-deployer | The ServiceAccount ci-deployer in namespace ci (as a user) |
system:serviceaccounts:ci | Group: every ServiceAccount in namespace ci |
system:serviceaccounts | Group: every ServiceAccount in the cluster |
system:authenticated | Group: everyone who logged in, people and ServiceAccounts |
system:unauthenticated | Group: anonymous requests (user name system:anonymous) |
system:masters | Group: bypasses RBAC completely. More on it below |
The system: prefix is reserved for Kubernetes. To see who the API server thinks you are:
kubectl auth whoamiThe output looks like this:
ATTRIBUTE VALUE
Username jane
Groups [platform-team system:authenticated]Bind to groups, and manage the membership in your identity provider. A binding per person does not survive the first reorg.
The default roles: cluster-admin, admin, edit, view
Every cluster ships with 4 user-facing ClusterRoles. You bind them, you do not write them:
| ClusterRole | What it allows | What it leaves out |
|---|---|---|
| cluster-admin | Any action on any resource | Nothing |
| admin | Read and write on most resources in a namespace, including Roles and RoleBindings | Writing resource quotas and the namespace itself |
| edit | Read and write on most objects in a namespace | Viewing or changing Roles and RoleBindings |
| view | Read only on most objects in a namespace | Secrets, Roles and RoleBindings |
3 things about them that are easy to get wrong:
- view cannot read Secrets. edit can. edit can also run Pods as any ServiceAccount in the namespace. So granting edit grants the API access of the most powerful ServiceAccount in that namespace
- cluster-admin in a RoleBinding is not "namespace admin". It includes the namespace object itself, so its holder can relabel the namespace and loosen its Pod Security settings. The role built for a namespace owner is
admin - They grow. admin, edit and view are aggregated ClusterRoles. Any ClusterRole labeled
rbac.authorization.k8s.io/aggregate-to-edit: "true"is merged into edit. That is how an operator adds its custom resources to the default roles
Aggregation is also how you extend them yourself:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: crontabs-view
labels:
rbac.authorization.k8s.io/aggregate-to-view: "true"
rules:
- apiGroups: ["stable.example.com"]
resources: ["crontabs"]
verbs: ["get", "list", "watch"]Everyone bound to view can now read crontabs. (The same mechanism means a Helm chart can quietly widen edit for everyone. Read the ClusterRoles a chart installs.)
There are also dozens of system: roles for the control plane. Leave them alone. The API server restores missing permissions on the default roles at every start, and breaking one can break the cluster.
Give a ServiceAccount permissions, from best to worst
People are half of RBAC. The other half is workloads: a CI runner that deploys, an operator, an app that reads a ConfigMap. They authenticate with a ServiceAccount.
The starting point is safe: outside kube-system, a ServiceAccount has no permissions beyond API discovery. Every namespace has a ServiceAccount named default, and a Pod that does not name one runs as it.
The Kubernetes docs rank 5 ways to grant permissions, from most secure to least:
- A role for 1 application's own ServiceAccount. The best practice
- A role for the
defaultServiceAccount of a namespace. Every Pod there that names no ServiceAccount gets it - A role for all ServiceAccounts in a namespace (the group
system:serviceaccounts:my-namespace) - A limited role for all ServiceAccounts in the cluster. Discouraged
- cluster-admin for all ServiceAccounts. Strongly discouraged. Anyone who can create a Pod is then a cluster admin
Number 1 in full: a ServiceAccount, a Role with exactly what the app needs, and a binding.
kubectl create serviceaccount config-reader -n dev
kubectl create role read-app-config \
--verb=get \
--resource=configmaps \
--resource-name=app-config \
-n dev
kubectl create rolebinding config-reader \
--role=read-app-config \
--serviceaccount=dev:config-reader \
-n devThen set serviceAccountName: config-reader in the Pod template, and test it before you deploy:
kubectl auth can-i get configmap/app-config -n dev \
--as=system:serviceaccount:dev:config-reader3 habits that make ServiceAccounts safer:
- Turn off the token where it is not needed. Most apps never call the Kubernetes API. Set
automountServiceAccountToken: falseon the ServiceAccount or the Pod (the Pod wins when both set it) - Never bind anything to
default. I leave the default ServiceAccount with nothing, so a Pod that forgot to name one gets nothing - Use short tokens for things outside the cluster.
kubectl create token ci-deployer -n ci --duration=1hgives a time-limited token. The docs recommend against long-lived tokens stored in Secrets
A binding in one namespace can name a ServiceAccount from another. That is how a CI runner in ci gets deploy rights in prod: the RoleBinding lives in prod, the subject says namespace: ci. For what else runs inside a Pod, see the Kubernetes Pod guide.
kubectl auth can-i: check permissions before you ship them
kubectl auth can-i asks the API server a yes or no question. It works whatever authorization mode the cluster uses.
# Me, in a namespace
kubectl auth can-i create deployments -n dev
# Someone else (you need permission to impersonate)
kubectl auth can-i list secrets -n dev --as=jane
kubectl auth can-i list secrets -n dev --as=jane --as-group=platform-team
# A ServiceAccount
kubectl auth can-i list pods -n prod --as=system:serviceaccount:ci:ci-deployer
# A subresource, a named object, a non-resource URL
kubectl auth can-i get pods --subresource=log -n dev
kubectl auth can-i get configmap/app-config -n dev
kubectl auth can-i get /healthz
# In every namespace
kubectl auth can-i list pods -A
# Everything I can do in a namespace
kubectl auth can-i --list -n devIt prints yes or no, and exits with status 1 when the answer is no. With -q it prints nothing, which makes it usable in a script:
kubectl auth can-i create deployments -n prod -q || echo "no deploy rights"2 limits to know:
--listcan be incomplete. It reports the rules the built-in authorizers can enumerate, which in practice means RBAC. Permissions that come from a webhook or from a cloud provider's own layer may be missing--astests the name you type. It does not look up the groups that person really has. Add them with--as-group, or the answer is wrong for anyone whose access comes from a group
I put can-i checks in the pipeline next to the RBAC manifests: 3 lines that must say yes, 3 that must say no. It is the cheapest test in the repo. One caution: --as needs the impersonate permission, which is a dangerous one. Limit the pipeline's impersonate rule with resourceNames to the identities under test. More everyday commands are in the kubectl cheat sheet.
How to read a Forbidden error
A denied request looks like this (an example, with made-up names):
Error from server (Forbidden): pods is forbidden: User "jane" cannot list resource "pods" in API group "" in the namespace "prod"Every part tells you something:
| Part | Meaning |
|---|---|
User "jane" | Who the API server thinks you are. If this is not who you expected, the problem is authentication or your kubeconfig context |
cannot list | The verb that was refused. kubectl get pods is a list. kubectl get pod web is a get |
resource "pods" | The resource, with the subresource when there is one: pods/log, pods/exec |
in API group "" | The API group to put in the rule. Empty is the core group |
in the namespace "prod" | Where a RoleBinding would have to exist |
2 variants:
- The message ends with
at the cluster scope: the resource is cluster scoped, or you asked across all namespaces with-A. Only a ClusterRoleBinding can allow that - For a ServiceAccount the user reads
system:serviceaccount:ci:ci-deployer. Check the namespace in it. A subject with the wrong namespace is an easy mistake to make
The message names the exact rule that is missing: API group, resource, verb, namespace. Copy those 4 values into a Role and you have the fix. Then decide whether that person should really have it.
Permissions that lead to more permissions
Some permissions look small and open the door to everything else. The Kubernetes RBAC good practices page lists most of them. These are the ones to look for in every review:
| Permission | Why it is bigger than it looks |
|---|---|
| get, list or watch on Secrets | All 3 return the Secret values. kubectl get secrets -A -o yaml is a list |
| create on Pods, Deployments, Jobs, CronJobs | A Pod can mount any Secret and ConfigMap in its namespace and run as any ServiceAccount there |
| create on pods/exec | A shell inside any Pod, with that Pod's Secrets and token |
| bind on roles or clusterroles | Lets you create a binding to a role with rights you do not have |
| escalate on roles or clusterroles | Lets you write a role with rights you do not have |
| impersonate on users, groups, serviceaccounts | Act as someone else and gain their rights |
| create on serviceaccounts/token | Issue a token for an existing ServiceAccount |
| nodes/proxy (even with get only) | Reaches the kubelet API, which can run commands in every Pod on the node, without audit logging or admission control |
| create on PersistentVolumes | A hostPath volume gives a Pod the filesystem of the node |
| Approving CertificateSigningRequests | Can mint client certificates with any name, including system components |
| Admission webhook configurations | A webhook reads every object admitted to the cluster. A mutating one can change them |
| patch on Namespaces | Changing labels can loosen Pod Security Admission or open NetworkPolicies |
Wildcards (*) | Cover everything above, and everything added later |
Review who holds these before you review anything else.

The second row deserves a pause, because in most clusters every developer has it. If you can create a Pod in a namespace, you can read every Secret in that namespace: mount it and print it. Denying get secrets to someone who can create Deployments is theater. The Kubernetes docs say it directly: boundaries within a namespace should be considered weak.
So the real unit of isolation is the namespace. Put things with different trust levels in different namespaces, and give people access per namespace. Inside one, assume that anyone who can deploy can read everything.
And the namespace is only a boundary when Pod Security Admission enforces the Baseline or Restricted standard on it. Without that, someone who can create a privileged Pod can reach the node, and from the node the Secrets of other namespaces. The Kubernetes Secrets guide covers what else protects a Secret.
Why you cannot grant what you do not hold
RBAC protects itself. You can create or update a Role only if you already hold every permission in it, at the same scope. You can create a binding only if you already hold every permission in the role it references.
When you hit that wall, the error says so:
Error from server (Forbidden): clusterrolebindings.rbac.authorization.k8s.io "ops" is forbidden: user "jane" (groups=["platform-team" "system:authenticated"]) is attempting to grant RBAC permissions not currently held: ...(Again an example. The real message lists the missing rules after the colon.)
The 2 exceptions are the verbs from the table above: escalate lets you write roles beyond your own rights, bind lets you bind roles beyond your own rights. This is why they are dangerous, and also how you delegate safely. A team lead who may hand out the 3 standard roles in their namespace, and nothing else:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: role-grantor
rules:
- apiGroups: ["rbac.authorization.k8s.io"]
resources: ["rolebindings"]
verbs: ["create"]
- apiGroups: ["rbac.authorization.k8s.io"]
resources: ["clusterroles"]
verbs: ["bind"]
resourceNames: ["admin", "edit", "view"]Bind that with a RoleBinding in the team's namespace. They can now create RoleBindings there to admin, edit or view, and to no other role beyond their own rights. Add delete on rolebindings if they should also revoke.
system:masters: the group RBAC cannot stop
system:masters is a group that is hard-coded into the API server. Its members skip authorization entirely:
- They bypass every RBAC check, and any authorization webhook too
- Deleting RoleBindings or ClusterRoleBindings does not take the access away
- They skip the escalation check from the previous section
With client certificates, the group is written into the certificate (the organization field). A certificate cannot be edited after it is issued, and Kubernetes does not support revoking one. So a kubeconfig with system:masters in it is a root key until the certificate expires or the cluster CA is rotated.
The cluster-admin ClusterRole is the alternative. It grants the same power through a normal binding, which means you can see it with kubectl get clusterrolebindings and remove it. kubeadm makes the difference visible: admin.conf uses a group bound to cluster-admin, and super-admin.conf uses system:masters and is meant for emergencies, such as a cluster locked by an RBAC mistake.
My rule: nobody's daily kubeconfig contains system:masters, and the emergency credential lives somewhere that leaves a trace when it is opened.
What RBAC cannot do
- Deny. There is no "everyone except". You structure the grants so the exception never gets the permission
- Look inside objects. No rules by label, by field or by image. "May create Pods, but only unprivileged ones" needs Pod Security Admission. Other field-level rules need a ValidatingAdmissionPolicy (stable since v1.30) or a policy engine
- Filter a list. A list request is allowed or refused as a whole
- Limit what a Pod does on the node. That is Pod Security Admission again
- Limit network traffic. That is NetworkPolicy
- Stop someone from filling the cluster. Anyone who can create objects can create a lot of them. Quotas handle that
RBAC is 1 layer. It decides who may call which API. What the created thing is allowed to do is decided elsewhere.
RBAC on EKS, GKE and AKS
RBAC objects are the same everywhere. What differs is where users come from, and whether the cloud adds a second permission layer next to RBAC. It usually does, and that layer does not show up in kubectl get rolebindings.
| Cloud | How identities map | What to watch |
|---|---|---|
| EKS | Access entries map IAM principals to Kubernetes groups or to EKS access policies. The older aws-auth ConfigMap is deprecated | With the ConfigMap method, the IAM principal that created the cluster gets system:masters and appears in no configuration. With access entries, the creator's admin access is visible and can be revoked |
| GKE | IAM and RBAC both count. A request is allowed if either one grants it | A broad IAM role on the project grants access in every cluster, whatever your RoleBindings say. Google Groups for RBAC needs a group named gke-security-groups |
| AKS | Microsoft Entra ID identities, with either Kubernetes RBAC or Azure RBAC for Kubernetes authorization (Azure role assignments, checked by a webhook) | Local accounts are enabled by default and give an admin credential that bypasses Entra ID. Microsoft recommends disabling them in production |
2 EKS details that are easy to trip on:
kubectl auth can-i --listdoes not show permissions that come from EKS access policies- The escalation check counts only permissions granted through Kubernetes RBAC. A principal whose rights come only from an access policy can be refused when creating a Role or a binding, even when can-i says yes. (The cluster admin access policy includes escalate and bind, so it is not affected.)
On every cloud the audit question has 2 parts: what do the bindings say, and what does the cloud's own layer grant on top.
Debug RBAC: symptoms and the first thing to check
| Symptom | Likely cause | First check |
|---|---|---|
| Forbidden, and the user in the message is not who you expected | Wrong kubeconfig context or credentials | kubectl auth whoami |
Forbidden for User "system:anonymous" | The request carried no credentials | The token or certificate in your kubeconfig |
Forbidden in the namespace "x" | No binding in that namespace, or the binding is in another one | kubectl get rolebindings -n x -o wide |
Forbidden at the cluster scope | Cluster scoped resource or -A, and only a RoleBinding exists | kubectl get clusterrolebindings -o wide |
| The binding exists, access still denied | Typo in the subject name, wrong kind, or the group is not in the user's token | kubectl auth whoami, then compare with subjects |
| A ServiceAccount is denied although it is bound | The subject has the wrong namespace, or the Pod runs as default | kubectl get pod NAME -o jsonpath='{.spec.serviceAccountName}' |
The denial ends with RBAC: and a "not found" error | A binding references a role that does not exist | kubectl get rolebindings,clusterrolebindings -A -o wide, and look for the role name |
kubectl get NAME works, kubectl get of the whole kind fails | The rule uses resourceNames | If the rule grants list: add --field-selector=metadata.name=NAME. If it grants get only: keep asking by name |
| Logs or exec denied, get Pods works | Missing subresource rule | Add pods/log, or create on pods/exec |
| Validation error when changing a binding's role | roleRef is immutable | Delete and recreate, or kubectl auth reconcile |
| "attempting to grant RBAC permissions not currently held" | The escalation check | Have someone who holds the permissions apply it, or grant bind on that role (for a binding) or escalate (for a role) |
| Rules added to admin, edit or view disappear | They are aggregated. The control plane overwrites rules | Put the rules in a new ClusterRole with the aggregate label |
| A permission removed from a default role comes back | The API server restores default roles at every start | Create your own role and bind that |
If the cluster keeps audit logs, every logged request carries the annotations authorization.k8s.io/decision (allow or forbid) and authorization.k8s.io/reason. When RBAC allowed the request, the reason names the binding that allowed it. That is the fastest way to answer "why can this account do that". When the reason names no binding, look at system:masters, a webhook or the cloud's own layer.
Kubernetes RBAC best practices: a checklist
- Grant per namespace with RoleBindings. Every ClusterRoleBinding has a written reason
- Bind groups from your identity provider. No bindings to individual people
- No wildcards in roles you write
- Nobody uses cluster-admin day to day. Admins have a normal account and a separate admin one, or impersonate one when needed
- No daily kubeconfig contains system:masters
- One ServiceAccount per workload. Nothing of yours bound to
default, tosystem:serviceaccountsor tosystem:authenticated(the built-in discovery bindings stay) automountServiceAccountToken: falsefor workloads that do not call the API- List who holds the permissions from the escalation table: Secrets, workload creation, bind, escalate, impersonate, nodes/proxy
- Review what is bound to
system:unauthenticatedand remove what you can. A change to a built-in binding only survives an API server restart with the annotationrbac.authorization.kubernetes.io/autoupdate: "false" - Treat edit as "can read Secrets in this namespace". Use view for people who only look
- Keep RBAC in Git, apply it with
kubectl auth reconcile --remove-extra-permissions --remove-extra-subjects, and test it withkubectl auth can-iin the pipeline - Read the ClusterRoles of every Helm chart and operator before you install it
- Remove bindings when people and services leave. A reused name inherits them
- On a managed cluster, review the cloud's access layer together with the bindings
I run number 8 once a quarter. There is always something.
What changed in recent releases
The 4 RBAC objects are stable. The machinery around them keeps moving:
| Version | Change |
|---|---|
| v1.28 | The API behind kubectl auth whoami (SelfSubjectReview) became stable |
| v1.30 | ValidatingAdmissionPolicy became stable: field-level rules in CEL, without a webhook |
| v1.32 | The structured authorization configuration file (--authorization-config) became stable. It allows several webhooks with their own failure policies |
| v1.34 | Authorization with field and label selectors became stable. It passes selectors to authorization webhooks. RBAC rules did not gain selectors |
| v1.36 | Constrained impersonation reached beta and is on by default: you can allow impersonating an identity for specific actions only. The plain impersonate verb is all or nothing |
| v1.37 | The core machinery for Conditional Authorization was added, which lets an authorizer allow a request depending on its content. Early groundwork, nothing to configure yet |
FAQ
What is RBAC in Kubernetes?
RBAC (role-based access control) is the authorization mode that decides which users, groups and ServiceAccounts can do which actions through the Kubernetes API. Permissions are written as rules in Roles and ClusterRoles, and given to subjects with RoleBindings and ClusterRoleBindings.
What is the difference between a Role and a ClusterRole?
A Role lives in 1 namespace and holds rules for resources in that namespace. A ClusterRole has no namespace. It can also hold rules for cluster scoped resources such as nodes and for non-resource URLs such as /healthz. A ClusterRole bound with a RoleBinding applies in 1 namespace. Bound with a ClusterRoleBinding, it applies in all of them.
What is the difference between a RoleBinding and a ClusterRoleBinding?
A RoleBinding grants a Role or a ClusterRole inside its own namespace. A ClusterRoleBinding grants a ClusterRole across the whole cluster. A ClusterRoleBinding cannot reference a Role.
How do I check what permissions I have in Kubernetes?
Run kubectl auth can-i --list -n NAMESPACE to list what you can do in a namespace (it can miss permissions that come from a webhook or a cloud layer), and kubectl auth can-i VERB RESOURCE for a single question. kubectl auth whoami shows the user name and groups the API server sees.
Is RBAC enabled by default in Kubernetes?
In practice yes. kubeadm turns it on, and EKS, GKE and AKS run with it. The kube-apiserver binary itself defaults to AlwaysAllow, so on a hand-built control plane you have to set --authorization-mode to include RBAC.
Can Kubernetes RBAC deny access?
No. RBAC rules only add permissions, and anything without a matching rule is denied by default. To remove access you remove the binding that grants it. For writes, an admission policy can refuse what RBAC allowed. For reads there is no deny: admission never sees get, list or watch, so you structure the grants.
How do I give a Pod access to the Kubernetes API?
Create a ServiceAccount, create a Role with the rules the app needs, bind them with a RoleBinding, and set serviceAccountName in the Pod spec. Unless automount is turned off, the token is mounted into the Pod and rotated automatically.
What is cluster-admin?
cluster-admin is the built-in ClusterRole that allows any action on any resource. Bound with a ClusterRoleBinding it gives full control of the cluster. Bound with a RoleBinding it gives full control of 1 namespace, including the namespace object itself.
RBAC is easy to switch on and easy to let rot: the first year, everyone gets cluster-admin "for now". If you want a second pair of eyes on who can do what in your clusters, book a free DevOps assessment.




