Designing least-privilege Kubernetes RBAC roles

A practical guide to building Kubernetes RBAC that holds up in audits: role patterns, wildcard and escalation risks, break-glass handling and binding reviews.

On this page

Designing least-privilege Kubernetes RBAC roles for audits

Least-privilege RBAC in Kubernetes means every user, group and service account holds only the verbs on the resources it needs, in the namespaces where it needs them, and nothing more. Teams need to design it when a self-managed cluster was opened up with broad roles for speed during its early months and now has to pass an access review. Typical symptoms include cluster-admin bindings given to whole engineering groups, * in verbs or resources, and service accounts that can read Secrets across the cluster. Retrofitting roles after the fact is slower than designing them before the first workload lands, so the work is worth scheduling as soon as the access review date is known.

RBAC is the authorization layer in the Kubernetes API server. It runs only after authentication has established who the caller is, whether through client certificates, OpenID Connect tokens or another configured method. RBAC then decides what that identity may do. Four objects make up the model: a Role grants permissions inside one namespace, a ClusterRole grants permissions cluster-wide or can be reused across namespaces, and a RoleBinding or ClusterRoleBinding attaches a role to subjects. A ClusterRole bound with a RoleBinding is limited to that binding's namespace, which is a common pattern for reusable read-only roles. Auditors will look at both the roles and the bindings, so the design must cover both.

Before writing any role, confirm which authentication method your clusters use and how group claims reach RBAC, because bindings are only as precise as the identities they reference. Then inventory the existing ClusterRoleBinding and RoleBinding objects, for example with kubectl get clusterrolebindings -o wide, and record who or what holds each one. The output of this inventory is the starting point for role patterns for platform, application and read-only users, which the sections that follow cover in detail. Ask your team to confirm that the cluster's audit logging captures authorization decisions, since reviewers will need evidence that changes were tested and that access was used as intended.

How users, bindings, roles and permissions connect

The path starts with an authenticated identity: a client certificate, an OIDC group or a service account. A RoleBinding or ClusterRoleBinding links that subject to a Role or ClusterRole, and the role grants verbs on resources either inside one namespace or across the cluster. The break-glass credential sits outside this path and should be used only under a documented procedure. The binding review point is where teams check that each subject still needs each grant, and it is the step most often skipped.

Subjects reach permissions only through bindings, with break-glass kept outside the normal path.

Role patterns for platform, application and read-only users

Platform operators maintain shared cluster components such as ingress, monitoring, storage classes and node-level add-ons. They usually need to read many cluster-scoped objects, but their write access should be limited to the specific resources they change. A common pattern is a ClusterRole that grants read verbs on nodes, namespaces, persistent volumes and storage classes, combined with a narrow ClusterRole for the components they operate, bound through a ClusterRoleBinding.

  • Read broadly, write narrowly: Grant get, list and watch on cluster-scoped inventory, and limit create, update and patch to named resources such as a specific Deployment or CustomResourceDefinition in one namespace.
  • Avoid wildcard verbs and resources: A rule using * for verbs or resources silently includes future resource types and destructive verbs such as delete and deletecollection.
  • Separate node and cluster administration: Keep node drain and cordon rights in a role that only the on-call rotation holds, so routine configuration work does not carry that power.
  • Review custom resources explicitly: Operators that install CRDs often need broad rights over their own API group, so scope those rules to that group rather than to every API.
  • Check escalation paths: Any right to create or bind RoleBindings, or to use the bind and escalate verbs, can let a user grant themselves more access than they hold.

Before approving a platform role, list every verb and resource it grants and confirm each one with the team that operates the component.

Which RBAC building block fits which access need

This table compares the four RBAC building blocks a team combines to grant access: Role, ClusterRole, RoleBinding and ClusterRoleBinding, plus aggregated ClusterRoles. Read each row as a question you answer before writing a manifest, with the risk that usually follows a wrong choice and what to check in your own cluster. The main takeaway is that the scope of the binding, not the name of the role, decides how far access reaches.

Building blockWhen it fitsMain riskWhat to confirm in your environment
RoleAccess that belongs to one namespace, such as an application team deploying into its own namespaceTeams copy a ClusterRole into many namespaces and lose track of which copies differWhich namespaces each team owns and whether a single Role can be reused across them
ClusterRolePermissions for cluster-scoped resources such as nodes or namespaces, or a reusable definition bound per namespaceBound with a ClusterRoleBinding, it grants the permission in every namespace at onceWhether the rules are needed cluster-wide or only as a template for namespace bindings
RoleBinding to a ClusterRoleGive a team the same verbs in one namespace without creating a separate Role for each namespaceThe binding limits access to one namespace, but the ClusterRole may still include rules broader than the team needsWhich rules the ClusterRole contains and whether a narrower Role would be safer
ClusterRoleBindingCluster-wide duties such as platform operators or monitoring agents that must read across namespacesSubjects gain access to every namespace, including future ones, so an overly broad binding is hard to noticeWhich groups or service accounts are bound and whether each one still needs cluster-wide reach
Aggregated ClusterRoleExtending built-in roles such as view or edit with custom resources installed by an operator or add-onAny ClusterRole with a matching aggregation label is merged in, so a later install can widen existing users' accessWhich add-ons and operators write aggregation labels and what rules they add to the built-in roles
Service account bindingsWorkloads that call the API, bound to a Role for their own namespaceDefault service accounts often receive bindings by accident, and tokens may be mounted into pods that do not need themWhich service accounts are bound, in which namespaces, and whether automounting of tokens is turned off where unused

Avoiding wildcards and escalation paths in RBAC

Most RBAC audit findings come from a small set of permissions that let a user grant themselves more access than their role was meant to carry. The cards below cover the wildcard grants and escalation verbs that do this, and how to find each one in your own bindings. Check each card against every Role and ClusterRole in the cluster, not only the ones your team wrote.

Wildcard verbs and resources

A rule with * in the verbs or resources field matches every current and future API operation in its scope, so one line can grant far more than the role name suggests. New custom resources added by operators fall under the wildcard automatically, which makes the grant drift over time. To check, search every Role and ClusterRole for * in verbs, resources and apiGroups, then list which subjects are bound to each match.

Create on role bindings

A user who can create RoleBindings or ClusterRoleBindings can bind any role they can reach, including ones that carry more rights than they hold. Kubernetes blocks this only when the user already holds the permissions being granted, unless the bind or escalate verbs are present. To check, list subjects with create, update or patch on rolebindings and clusterrolebindings, and confirm each one is a cluster administrator.

The bind and escalate verbs

The bind verb lets a user create a binding to a role without holding that role's permissions, and escalate lets them edit a role to add permissions they do not have. Both bypass the normal escalation check, so they belong only to the controllers and administrators who manage access. To check, search Roles and ClusterRoles for these verbs on roles, clusterroles and their bindings, and treat every match as a finding until it is justified.

Impersonation permissions

The impersonate verb lets a user act as another user, group or service account, and the API server applies that identity's permissions to the request. Impersonating a group such as system:masters would give full cluster rights. To check, look for impersonate on users, groups, serviceaccounts and userextras in every role, and confirm the holder has a documented need to act as someone else.

Pod creation that mounts secrets

Anyone who can create pods in a namespace can mount any Secret or service account token in that namespace into a container they control, then read it through the pod. This makes create on pods, and on workload controllers that generate pods, equivalent to reading Secrets in many cases. Secrets are stored unencrypted in etcd by default, so this path matters even when Secret reads are tightly limited. To check, list every subject that can create pods or Deployments in each namespace that holds sensitive Secrets.

Secrets good practices

Nodes proxy and pod exec

The nodes/proxy subresource lets a user reach the kubelet API and, in many setups, run commands in any pod on that node. The pods/exec and pods/attach subresources give interactive shells in pods, which exposes whatever those pods can read. Both are often granted to support staff without review. To check, search for nodes/proxy, pods/exec and pods/attach in rules, then confirm which workloads and secrets the holders can reach through them.

Keeping system:masters for break-glass only

The system:masters group is bound to cluster-admin privileges, and RBAC rules cannot restrict it. Any credential that carries this group can do anything in the cluster, including editing or deleting RoleBindings and ClusterRoleBindings that you use to control everyone else. For that reason, keep it out of every day-to-day identity path. Map people to roles through your identity provider, grant them namespace or cluster roles you have designed, and reserve system:masters for a small set of emergency credentials that exist so the cluster can be recovered when normal access fails, such as when the OIDC issuer or the identity provider is down or a bad RBAC change locks out every operator.

Treat the break-glass credential as an operational asset with a documented lifecycle. Confirm with your own setup how it is issued (for example, a client certificate signed by the cluster CA or the admin kubeconfig generated at install time), where the private key or kubeconfig is stored (a sealed offline vault or a secrets manager with dual control), who can retrieve it and under what approval, and whether every use is alerted on through API audit logs filtered for the system:masters group. Rotation also needs a plan: a kubeadm-generated client certificate typically has a fixed validity period and cannot be revoked once issued, so confirm the expiry date in your cluster and schedule renewal, and rotate the credential after every use or every break-glass drill.

When you move people to OIDC, keep one break-glass path that does not depend on that identity provider. Confirm in your own environment whether the admin kubeconfig on the control plane nodes is still present and protected, and whether you can rebuild access from it if the API server authentication configuration is broken. Test the procedure in a non-production cluster: revoke the break-glass path, simulate an OIDC outage, and recover using only the sealed credential. Record who can perform each step, the expected time to recover, and the review date. Then review the system:masters binding and its membership at each access review, so that no one has been added to the group through an informal exception.

How to roll out least-privilege RBAC in a live cluster

This sequence moves an existing cluster from broad, person-specific permissions to namespace-scoped roles bound to identity provider groups, with each change checked before the next one starts. The result is a cluster where access is documented, tested and reviewed on a schedule.

  1. Inventory existing bindings and service accounts

    Export every ClusterRoleBinding and RoleBinding, along with the subjects they name and the service accounts that pods use. Include the users and groups that hold cluster-admin, and flag any binding that uses a wildcard verb, resource or API group. Record which workloads depend on each service account so nothing breaks when permissions shrink. This step is done when the team has a written list of every binding, its owner and its purpose, and nobody is left with an unexplained entry.

  2. Define role patterns for each persona

    Write a short catalog of roles for the personas in your organization, typically platform operators, application developers scoped to their namespaces, and read-only auditors or support staff. For each role, list the resources and verbs it needs and nothing else. Review the draft with the platform, security and application leads. This step is done when each persona maps to one named role, and the review has removed or justified every wildcard.

  3. Build namespace-scoped roles first

    Create Role and RoleBinding objects inside each team namespace before touching cluster-wide permissions. Start with the read-only and developer roles, then add the platform roles with the narrowest scope that still works. Keep ClusterRoles for resources that are truly cluster-scoped, and avoid granting access to Secrets beyond what the workload requires. This step is done when each team namespace has its roles in version-controlled manifests and a dry-run apply produces no errors.

  4. Bind roles to identity provider groups

    Map each role to a group claim issued by your identity provider rather than to individual usernames. Confirm with the identity team that group membership is populated in the tokens the API server receives, and that the group names match the bindings exactly. Test one group end to end with a real login before rolling out the rest. This step is done when a test user in each group can perform the expected actions and nothing beyond them.

  5. Remove direct user bindings

    Once group bindings work, delete the bindings that name individual users, and check that no workflow still depends on them. Schedule the removal per team so that a failed group mapping does not lock out an on-call engineer. Keep a short list of break-glass accounts that are documented and stored under separate controls. This step is done when a fresh export shows no direct user subjects outside the break-glass list.

  6. Audit cluster-admin and system:masters use

    Identify every subject bound to cluster-admin and confirm that membership of the system:masters group is limited to the break-glass credential. Review API server audit logs for requests made with those identities over a recent period, and record the reason for each use. Move routine administrative work to a scoped platform role. This step is done when cluster-admin has only the agreed holders, and the audit review shows no routine work performed through break-glass access.

  7. Test permissions with can-i and impersonation

    Use kubectl auth can-i with the --as and --as-group flags to check that each persona can perform its allowed actions and is denied the rest, including Secrets, RBAC objects and pod exec. Run the same checks in a scripted suite stored with the manifests so that a change to a role fails a test. Include negative cases for privilege escalation, such as creating or editing roles and binding them. This step is done when the suite passes and each denied check returns no.

  8. Enforce periodic binding review

    Set a recurring review of all bindings, the group membership they depend on and the audit findings from the cluster-admin check. Assign an owner for each namespace and record each review's date, changes and approvals. Feed the scripted permission tests and binding export into the review so reviewers see drift rather than relying on memory. This step is done when the review schedule, owners and evidence location are documented and the first review has been completed and signed off.

Operational checks that keep bindings clean after go-live

A least-privilege design decays after go-live as people change teams, projects end and service accounts outlive their workloads. The six checks below catch that drift: scheduled reviews, unused bindings, change logging, token hygiene, Secrets protection and Pod Security Standards, which limit what a compromised workload can do even when a role is too broad.

Schedule binding reviews

Set a recurring review of every RoleBinding and ClusterRoleBinding, with a named owner for each namespace and each cluster-wide grant. Ask the owner to confirm who still needs the access and why. Export the current bindings with kubectl so reviewers compare the same snapshot, and record the approval so auditors can see the review happened. Start with cluster-admin and any binding that targets a group rather than a named user.

Detect unused bindings

A binding that nobody has used for a long time is a candidate for removal, even if its owner still feels it is needed. Use audit logs to find subjects that have not made requests in your review window, and compare that list with the bindings you exported. Removing an unused grant is usually lower risk than leaving it, but confirm with the owner first, since some access is used only during on-call or release work.

Audit RBAC changes

Enable API server audit logging for changes to Role, ClusterRole, RoleBinding and ClusterRoleBinding objects, and send the events to storage that the platform team cannot quietly edit. Check that each change records the requesting identity, the object and the timestamp. Without this record, a reviewer can see what access exists but not how it got there or who approved it.

Check service account tokens

Review which service accounts have bindings and whether their pods need to call the API at all. Disable automatic token mounting for workloads that do not talk to the API, and set it explicitly in the pod or service account spec. Confirm that each service account used by a workload has only the role it needs, and that no human-facing group is bound to a service account by mistake.

Protect Secrets at rest and in reads

The Kubernetes Secrets good practices page notes that Secrets are stored unencrypted in etcd by default. Confirm that encryption at rest is configured and that the key management approach matches your policy. Then check which roles grant get, list or watch on Secrets, because listing or watching exposes every Secret in the scope, even when a user never reads one by name.

Secrets good practices

Use Pod Security Standards alongside RBAC

RBAC controls who can create workloads, but Pod Security Standards limit what those workloads can do on the node. Kubernetes defines Privileged, Baseline and Restricted levels, enforced per namespace by Pod Security Admission. Apply at least Baseline to application namespaces and Restricted where the workloads allow it, and review any exemption. A role that lets a developer deploy pods is much less risky when the admitted pods cannot run as privileged.

Pod Security Standards

Questions teams ask before designing Kubernetes RBAC

How much effort does a least-privilege Kubernetes RBAC design take?

Effort depends mostly on how many teams and clusters need separate access, how many bindings already exist, and how far the audit scope reaches. A design for one cluster with a few teams is a bounded exercise, while a shared platform with many namespaces, service accounts and legacy cluster-wide bindings takes considerably longer because each existing binding has to be traced to an owner and a need. No public effort figure applies to your environment, so ask any provider for a breakdown by inventory, role design, migration of existing bindings, testing and documentation. Ask them to state which of those items assumes your identity groups already exist.

Can our own platform team design RBAC without outside help?

Yes, many teams do this internally, provided someone owns the design and has time to test changes before they reach production. The work is mostly careful reading of the Kubernetes RBAC model, an honest inventory of who needs what, and disciplined review of wildcards, escalation paths and cluster-wide bindings. Teams that struggle usually lack a second reviewer, a way to test that a role grants only what it should, or time to chase owners of old bindings. An outside partner can add a review pass, a test suite and a written rationale for each role, which is useful when an auditor will later ask why a role exists.

What do we need to provide before the RBAC work starts?

Plan to provide four things: a current inventory of existing Role, ClusterRole, RoleBinding and ClusterRoleBinding objects, a list of the teams and job functions that use the cluster, the identity groups those people sign in with, and a change window for applying binding changes. The inventory can be exported with kubectl and reviewed as text. Identity groups matter because RBAC bindings are easier to audit when they reference groups from your identity provider rather than individual users. Confirm with your identity team how group claims reach the API server in your setup before the design depends on them.

How long does a least-privilege RBAC project take?

Duration is set by the number of roles to define, the number of existing bindings to investigate, and how quickly owners respond when access is removed. Identity integration, such as moving people off certificate-based users, can add time if it is not already in place. No supplied duration applies to your organization, so ask for a timeline tied to written deliverables, with milestones for inventory, role design, staged rollout to a non-production cluster and production cutover. Ask how many review rounds are included and how retesting is handled after changes.

Does RBAC alone satisfy our audit requirements?

No. RBAC is one control, and it does not satisfy an audit by itself. Auditors assess evidence: documented role definitions, a record of who holds which bindings, proof that bindings are reviewed on a schedule, audit logs that show access decisions, and a process for removing access when people change roles. DeployOpen prepares systems, controls and evidence for compliance assessments, but independent auditors and certification bodies issue any audit report or certification. The CIS Kubernetes Benchmark is a useful reference for access settings, and your compliance lead should confirm which framework controls apply to your organization.

What changes after a Kubernetes upgrade to RBAC?

Upgrades can change which API versions and resource fields are available, so review RBAC objects against the target release before upgrading and confirm that any custom tooling that generates roles still works. The Kubernetes version skew policy requires the kube-apiserver to be upgraded first, one minor version at a time, which means your RBAC changes should be tested on the cluster version you will actually run. Bindings usually survive an upgrade unchanged, but new built-in roles or changed default behavior in a release can alter effective permissions, so rerun your access tests and review the release notes for each minor version you cross.

What is the most common mistake in RBAC designs?

The most common mistake is granting broad rights to get work unblocked and never removing them. Wildcard verbs or resources, cluster-wide bindings for namespace-scoped work, and permission to create or bind roles all open escalation paths, because a user who can create a RoleBinding can often grant themselves more access. Keep system:masters for break-glass use only, avoid wildcards in roles, and schedule reviews of bindings so temporary access is removed. Testing with impersonation or access checks before rollout shows whether a role grants more than intended.

Limits to confirm in your environment before you commit

Role design depends on facts about your cluster that the RBAC manifests do not show. The five cards below cover the points to settle with identity, platform and application owners before you bind anyone to a role, so the design you approve is the one the cluster can enforce.

Authentication method and group claims

RBAC binds subjects by name and group, so the roles you design are only as good as the identity the API server receives. Confirm whether users arrive through client certificates, OIDC tokens or a webhook, and which claim carries group membership. Ask the identity team whether groups are sent in the token at all, and whether a user who leaves the directory loses cluster access on the same day. Use system:authenticated only with care, since every authenticated identity inherits what it grants.

Authentication docs

Control plane change restrictions

Some managed services and distributions limit what you can change in the API server, including authorization modes, admission plugins and audit policy. If the platform team cannot alter these settings, some role and binding controls will have to live elsewhere. Ask the provider or platform owner which authorization modes are enabled, whether custom admission webhooks are allowed, and who can edit cluster-scoped RBAC objects.

Kubernetes version and support window

RBAC behavior and the APIs that carry roles change between minor releases, and patch support ends on a fixed date. Confirm which minor version each cluster runs and check it against the published support dates. The Kubernetes release page lists the currently supported minors, so check whether your version is still receiving fixes before you base a long-lived role model on it.

Oldest supported minor
1.35
Kubernetes releases

Pod Security and admission controls

Least-privilege roles limit who can create workloads, but the Pod Security Admission controller limits what those workloads may do once created. Confirm which Pod Security Standard applies to each namespace and whether any namespace is labeled privileged. Ask the security team who owns those labels, because a role that lets an application team edit namespace labels can weaken them.

Pod Security Standards

Dependence on broad application permissions

Many Helm charts, operators and CI jobs were written with cluster-admin or wildcard rules. Before you tighten a role, inventory the service accounts each application uses and the verbs they call. Ask application owners to run their workloads against a test namespace with the proposed role, and record each denied request so the team can decide whether to fix the application or grant a narrow exception.

Official Kubernetes references for RBAC and access control

Before you write any role, read the Kubernetes authentication documentation. RBAC only answers what an identity may do after the API server has decided who that identity is, and the authentication page explains the methods Kubernetes accepts: X.509 client certificates, bearer tokens including OpenID Connect and JWT, webhook token authentication and authenticating proxies. Kubernetes does not store normal users as API objects, so your role bindings are only as trustworthy as the identity source behind them. Confirm which method your clusters use today and whether it can be changed without rebuilding the control plane, because that answer shapes every binding you design.

Two adjacent references matter for RBAC reviews. The Good practices for Kubernetes Secrets page states that Secrets are stored unencrypted in etcd by default and recommends restricting list and watch access with least-privilege RBAC. Any role that grants read access to Secrets, or list and watch on them, should be reviewed against that guidance and against whether encryption at rest is enabled. The Pod Security Standards define the Privileged, Baseline and Restricted profiles enforced per namespace, which complements RBAC by limiting what workloads may do once a user is allowed to create them.

For a benchmark-based review, the CIS Kubernetes Benchmark is the consensus configuration guide that auditors commonly use as a reference point. Use it as a checklist to confirm the wording of your controls, not as a substitute for your own evidence. Ask your assessor which benchmark version and control sections they will test against, and keep a dated export of your role and binding inventory so the evidence matches the version you reviewed.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.