Direct answer
Kubernetes RBAC permissions are additive and there are no deny rules, so the access Claude Code actually has is the union of every binding that applies to its identity, not the one Role you just edited. Before granting cluster access, review that union, prefer a namespace-scoped Role bound to the agent’s service account, restrict verbs and resources to what the task needs, and give the access an owner and an expiry. A broad ClusterRole bound for convenience is the single most common way an agent ends up with far more power than the task required.
The concrete win is an agent identity you can describe in one sentence: this service account, in this namespace, with these verbs. The concrete loss is that additive permissions make “least privilege” a moving target, because one new binding elsewhere can silently widen the union. Treat the review as recurring, not a one-time setup.
Why the review is the control that matters
An agent can only do what its identity allows. Every guardrail on the workstation, every permission prompt, and every plan gate sits downstream of what the cluster will actually accept from the agent’s service account. Get the identity right and the blast radius of a wrong suggestion is bounded. Get it wrong and no amount of prompting discipline saves you.
Three failures recur in agent RBAC. A ClusterRole with wildcard verbs gets bound to the agent because it was already in the repo. Two bindings each look narrow, but their union grants more than either, and nobody notices because each was reviewed alone. A service account created for one job keeps its permissions after the job ends, because nothing removed them.
None of these are exotic. They are what happens when RBAC is reviewed one object at a time instead of as a union.
RBAC Permission Model
Official, F013: Kubernetes RBAC permissions are additive and the authorization result is the union of permissions granted through roles. The Kubernetes RBAC model has no deny rules.
That single property drives the whole review. Because there is no deny, you cannot subtract access with a second object. Because permissions combine, evaluating one Role in isolation undercounts what an identity can do.
Reviewing RBAC therefore means answering a different question than “is this Role correct.” The question is “what can this identity do, counting every binding that reaches it.” Those are different answers, and the second one is the one that matters for an agent.
| RBAC question | What it decides | Where it shows up |
|---|---|---|
| Which bindings reach the identity | The set of roles in force | kubectl auth can-i --list |
| What verbs each role grants | The effective action set | Role and ClusterRole rules |
| Whether any binding is cluster-scoped | Reach beyond one namespace | ClusterRoleBinding vs RoleBinding |
| Whether the union exceeds the task | Least privilege verdict | Access review record |
Read the first row as the practical starting point. kubectl auth can-i --list against the agent’s service account shows the effective union, which is the artifact a reviewer should evaluate rather than a single Role definition.
The additive model is also why an agent’s blast radius is hard to reason about from the manifest. A Role that grants patch on Deployments looks narrow. Add a second binding that grants create on pods in the same namespace, and the agent can now run a workload it could not before, which is a different set of capabilities than either binding describes alone. The union is the truth, and the union is what you review.
Roles Versus ClusterRoles
Official, F014: a Role is namespace-scoped, while a ClusterRole can define cluster-scoped or cross-namespace permissions. A RoleBinding can reference a ClusterRole, but it still grants that permission only within the binding’s namespace.
That last sentence is the detail that changes designs. Binding a ClusterRole through a RoleBinding does not make it cluster-wide; it scopes a cluster-level permission set to one namespace. This is a legitimate way to grant a broad permission set narrowly.
| RBAC object | Scope | Review evidence |
|---|---|---|
| Role | One namespace | Namespace match to the task |
| ClusterRole (cluster-wide via ClusterRoleBinding) | Whole cluster | Justify why cluster scope is required |
| ClusterRole (via RoleBinding) | One namespace | Confirm the binding namespace matches |
| ClusterRole with wildcard verbs | Whatever scope the binding grants | Reject unless there is no narrower set |
Prefer a Role bound to the agent’s service account in the task namespace. Reach for a ClusterRole only when the task genuinely crosses namespaces or needs a cluster-scoped resource, and say in the review record why.
The distinction interacts with server-side apply, where the agent may only need to write specific fields on specific objects. The server-side apply ownership checks guide covers field ownership, and the network policy blast radius guide covers a case where enforcement depends on the CNI rather than the manifest.
Binding subjects
A binding connects a role to a subject. Subjects can be users, groups, or service accounts, and an agent’s access comes from whichever service account its workload runs as.
Official, from the RBAC reference: bindings grant the permissions defined by a role to subjects such as users, groups, and service accounts, and an identity’s effective access may come from multiple bindings.
| Subject type | Typical use for an agent | Review question |
|---|---|---|
| Service account | The agent workload’s identity | Is this the SA the workload actually runs as? |
| Group | Team or automation group membership | Who is in the group today? |
| User | Individual human access | Does a human need this verb at all? |
A service account is not harmless by default. It is an identity with whatever the union grants, and a leaked token for it is a live credential. Treat agent service accounts with the same ownership discipline as human access: named owner, business justification, review date.
Additive Permissions
Additivity is where reviews break in practice. Two bindings that each look reasonable can produce a union that grants a dangerous combination, and removing one binding may not reduce access if another grants the same permission.
Official, F013 caveat: review every applicable binding rather than evaluating one Role in isolation. Removing one binding may not reduce access if another binding grants the same permission.
# effective permissions for the agent service account
kubectl auth can-i --list --as=system:serviceaccount:agents:claude-code -n target-ns
# who can do a sensitive action across the cluster
kubectl who-can delete deployments --all-namespacesTwo habits catch the union problem. Ask auth can-i --list rather than reading one Role. When you remove a binding, re-run the effective-permission check to confirm access actually dropped, because a second binding may have been granting the same thing all along.
Agent Identity Design
Design the agent identity from the task outward. Start with what the workflow must do, translate each action into a verb and resource, then build the narrowest role that expresses it.
A read-heavy planning task needs get, list and watch on the resources it plans. A task that applies manifests needs create, update and patch on those objects, plus delete only if the workflow genuinely destroys resources. A task that reads secrets needs an explicit decision, because secret read access is credential access.
| Requested action | Minimum verb | Scope |
|---|---|---|
| Read configuration for planning | get, list, watch | Namespace |
| Apply manifests in a namespace | create, update, patch | Namespace |
| Delete resources as part of the task | delete | Namespace, explicit approval |
| Read secrets | get | Namespace, explicit justification |
| Read node or cluster state | get, list | Cluster, only if required |
Official, F015: Kubernetes recommends narrow verbs and resources and avoiding wildcards unless necessary. The caveat is that least privilege still requires testing the actual workflow and reviewing future permission changes, because a role that is too narrow fails in a way that tempts someone to widen it permanently.
Write down why each verb exists. A rule nobody can explain is a rule that will survive every future review for no reason.
Privilege Escalation Checks
RBAC has escalation paths that a narrow role can still enable. Two matter most for agent workflows.
A role that can create or patch bindings, or that can create service accounts plus bind roles, can escalate itself. An agent that can write to a namespace where a privileged service account exists may be able to run a workload as that account, depending on admission controls. The Pod Security admission gate reviews guide covers the workload admission side of that boundary.
| Escalation path | What it enables | Control |
|---|---|---|
| Role or binding write access | Grant new permissions | Exclude RBAC write verbs from agent roles |
| Workload creation in a privileged namespace | Run as a privileged identity | Admission policy plus namespace isolation |
| Secret read across namespaces | Credential access | Scope secret read to the task namespace |
| Subresource or wildcard verbs | Unintended action coverage | Replace wildcards with explicit resources |
Read the first row as the hard rule. An agent that can manage its own bindings can grant itself anything, which defeats the entire review. Exclude rbac.authorization.k8s.io write verbs from agent roles unless there is a specific, owned justification.
Access Review Evidence
A review produces evidence, not just a decision. Four artifacts answer most questions about an agent identity.
The effective permission output from auth can-i --list. The list of bindings that reach the identity, with an owner for each. The task justification for each verb and resource. A review date or expiry for the access.
| Binding subject | Business owner | Review or expiry |
|---|---|---|
| Agent service account | Platform team | Quarterly review |
| Break-glass ClusterRoleBinding | Named on-call | Expiry after each use |
| Group binding for automation | Automation owner | Annual review |
Evidence turns the review into something a second reviewer can check, and it is what makes the next review fast. Access recertification for agent identities covers the recurring cadence across cloud and cluster identities, and the SOC 2 change evidence packets guide covers packaging the record for an auditor.
Independent, OWASP: OWASP guidance on secure coding with AI recommends least privilege and human review for AI coding agents, and treats agent output as untrusted. Narrow RBAC is the technical expression of that principle on the cluster side.
Safe Default for New Teams
A team enabling Claude Code for cluster work should start from a default that fails safe. A dedicated service account for the agent, not a shared one. A namespace-scoped Role in the task namespace, with explicit verbs and no wildcards. No RBAC write verbs. No secret read unless the workflow needs it, and then scoped. A named owner and a review date on the binding.
This default bounds what a wrong suggestion can touch. Refinements come after the first workflows are running. Cloud IAM permission boundaries covers the equivalent ceiling on the cloud side, and infrastructure threat model boundaries covers modeling what the agent can reach across both.
Working with Claude Code on an RBAC review
Give the agent the service account and namespace, the workflow it should support, and the commands it may run. Ask for the effective permission union rather than a Role summary, and ask it to flag any verb or resource it cannot tie to the stated workflow.
The agent can enumerate permissions and propose a narrower role. Deciding which verbs a production agent should hold is a security decision. Claude Code security documentation describes the safeguards that govern what an agent session can do locally; they do not replace cluster RBAC. The AWS IAM policies reference is the equivalent permission model on the cloud side, and the union principle applies there too.
Who owns the RBAC review, and where it sits in the change process
An RBAC review that has no named owner decays into a document nobody re-runs, so treat ownership as part of the control rather than an afterthought. The owner of the agent’s binding should be the same platform or security owner accountable for the workload the agent touches, not the person who happens to hold the kubectl context that day. Assign the owner in the same step that assigns the binding, record the name next to the review date, and make re-running auth can-i --list that owner’s recurring responsibility.
Ownership also has to fit the wider approval path. A proposed binding change is an infrastructure change, and it belongs in whichever tier your approval matrix assigns it, which is the framing risk-tiered infrastructure approvals covers for sizing review depth to blast radius. Who signs off on that change is a RACI question, and the RACI ownership for infrastructure changes guide separates the approver from the person executing the apply. When the binding supports a Terraform-managed workload, the plan that introduces it should pass the same gate as any other change, and Terraform plan review gates covers that gate. If the change drifts later, Terraform drift triage covers telling an intended union change apart from an unreviewed one.
The review also earns its keep during incidents. A binding widened in a hurry under an active incident needs a time box and a post-incident review, which is the path change freeze emergency rules covers for exceptional changes. Rehearsing the decision before a live event is covered by NIST incident tabletops, and keeping the runbook that explains each binding current is covered by runbook ownership and review cadence. Treating the deny result itself as reviewable evidence is the angle policy as code audit before deny takes.
The concrete win, loss, and implication
The concrete win is a bounded identity. An agent scoped to one namespace with explicit verbs can propose and apply changes in that namespace without holding the keys to the cluster, so a wrong suggestion has a small blast radius.
The concrete loss is that least privilege decays. Bindings accumulate, tasks change, and one new binding elsewhere can widen the union without touching the agent’s Role. A review that was accurate last quarter can be stale today.
The practical implication is that RBAC is a recurring control, not a setup task. Teams that review the effective union on a cadence catch permission creep before an incident. Teams that review one Role at a time keep rediscovering that the union granted more than any single object did.
Related reading in this batch
RBAC is one of four Kubernetes boundaries in this batch. Server-side apply ownership checks covers field ownership on shared objects. NetworkPolicy blast radius reviews covers traffic policy and CNI enforcement. Pod Security admission gate reviews covers workload admission as a gate.
The cloud-side permission model appears in cloud IAM permission boundaries, with the reporting-versus-prevention tradeoff covered by policy as code audit before deny. Terraform state access, which is governed by similar identity splits, is covered by Terraform state locking and access controls. Incident and break-glass access paths are covered by break glass incident access controls.
Data gap and future update
The Kubernetes RBAC reference supports F013 through F015. The RBAC good-practices page was identified as a canonical source but was not fetched in the research pass, so its specific recommendations should be verified against the live page before quoting it directly.
No measurement of privilege-escalation incidents, over-granted bindings, or recertification coverage is reported here, because none was collected. The kubectl who-can command requires the krew plugin in many environments and is shown as a diagnostic example, not a guarantee it is present in your cluster. Escalation outcomes also depend on admission configuration and namespace isolation, which vary by cluster.
One AI API Key option for OpenAI-format agents
Claude Code uses an Anthropic-format route, so the One AI free model IDs are not a Claude Code model source. The packet records Claude IDs as unavailable on 2026-11-27.
OpenAI-format agents have a separate route: One AI API Key provides https://api.oneaiapikey.com/v1, one key, and 46 live free IDs. That is a different client and request format, not a workaround for Claude Code authentication. See the free model list for eligibility notes, the quickstart for request shape, or the cost calculator to compare hosted options.
FAQ
Does Kubernetes RBAC support deny rules?
No. RBAC permissions are additive and the authorization result is the union of granted permissions. You cannot subtract access with a second object, which is why reviewing the full union matters more than reviewing any single Role.
Why prefer a Role over a ClusterRole for an agent?
A Role is namespace-scoped, so it bounds the agent to one namespace. A ClusterRole can be cluster-wide or cross-namespace. Reach for a ClusterRole only when the task genuinely needs that reach, and note that a RoleBinding can scope a ClusterRole to a single namespace when a broad permission set is needed narrowly.
Can an agent escalate its own permissions?
It can if its role includes RBAC write verbs, such as creating or patching bindings. An agent that can manage bindings can grant itself anything. Exclude RBAC write from agent roles unless there is a specific owned justification, and watch workload-creation paths that could adopt a privileged service account.
Is a service account safer than a user binding?
Not inherently. A service account is an identity with whatever the union grants, and its token is a live credential. Give it the same ownership, justification and review discipline as human access.
How do I confirm removing a binding actually reduced access?
Re-run the effective-permission check for the identity after the change. Because permissions are additive, a second binding may have been granting the same permission, so removing one binding does not always reduce the union.
More Claude Code troubleshooting
- Claude Code Cloud Costs: Budget and Quota Guardrails
- Claude Code AISVS: Control Mapping for Platform Teams
- Claude Code Security Exceptions: Expiry and Ownership
- Claude Code Audit Evidence: Completeness and Integrity
- Claude Code Vendor Review: Security Evidence Checklist
- Claude Code Governance: Platform Council Charter
- Claude Code OpenTelemetry: Semantic Conventions for Agents
- Claude Code Incident Timelines: Request ID Correlation
- Claude Code SLO Alerts: Burn Rate During Changes
- Claude Code Error Budgets: Release Decision Policy
- Claude Code Postmortems: Evidence Without Blame
- Claude Code Log Pipelines: Health Checks Before Triage
Sources
- Official: Kubernetes RBAC authorization, supporting additive permissions, Role versus ClusterRole scope, and narrow verbs in F013, F014 and F015.
- Official: Kubernetes RBAC good practices, canonical reference for least-privilege recommendations.
- Official: Claude Code security documentation, supporting the boundary between local safeguards and cluster RBAC.
- Official: AWS IAM policies and permissions, reference for the equivalent cloud-side permission model.
- Independent: OWASP Secure Coding with AI Cheat Sheet, supporting least privilege and human review for AI coding agents.