Claude Code permissions your cluster enforces

Guardrails in a prompt or in the agent can be skipped. On a protected cluster, Claude's requests can reach Kubernetes as krust-agent, a separate user with fewer permissions than yours. Krust still checks every request against the tab's mode, and the API server enforces the limit too, so a request that gets past Krust still can't do more than krust-agent may.

Early access: cluster enforcement is free during early access.

Why Claude Code's permissions should live in the cluster

In a Claude Code tab, kubectl and helm talk to Krust's local proxy, which checks each request against the tab's mode: Read-only, Ask or Write. Without cluster enforcement, a request Krust lets through reaches the cluster as you, with your full access. A request Krust misreads would have that access too.

With cluster enforcement, the limit is also in the place Kubernetes already trusts: RBAC, checked by the API server.

Turning on Protected Clusters alone adds checks in Krust. Cluster enforcement builds on it and adds the API server:

Not protectedProtectedProtected and cluster-enforced
Krust checks the tab's modeYesYesYes
Your deletes in KrustTyped for high-impact kinds, such as StatefulSets and PVCs; a plain dialog for the restTyped, every oneTyped, every one
A Claude tab that would open in WriteOpens in WriteOpens in AskOpens in Ask
How long Write lastsUntil you switch back, unless you choose 15 minutes15 minutes at most15 minutes at most
Who the cluster seesYouYoukrust-agent, acting for you
A change Krust didn't let throughRefused by KrustRefused by KrustRefused by Krust, and by the API server
A change Krust approvedRuns with your accessRuns with your accessRuns with the write group's access, built-in edit by default
RBAC changesPossible if you may make themPossible if you may make themRefused, even when approved
Audit logYour nameYour nameYour name and krust-agent, with the tab's mode and session

A protected cluster without the setup shows Not set up in the Claude bar. Its requests still go as you.

How it works

Krust's proxy uses Kubernetes user impersonation. Your own credential still authenticates each request, and Krust adds headers that ask the API server to treat it as krust-agent, with the group krust:agent-read. A change that the tab's mode let through also carries krust:agent-write. The API server checks that you may act as krust-agent, then authorizes the request with only those groups.

The cluster token still never reaches the terminal, and Claude can't pick its own identity: Krust refuses --as and --as-group from the tab. AI agent security: how it works follows one request end to end, with diagrams, and covers GKE IAM, EKS access policies and the audit log.

Set it up

  1. Open Settings › Security and turn on Protected Clusters for the cluster. On a protected cluster, your deletes need typed confirmation, a Claude tab that would open in Write opens in Ask instead, and Write lasts 15 minutes at most.
  2. Choose Set Up Cluster Enforcement… in Settings, or in the bar above a Claude tab on that cluster.
  3. Krust explains what changes, then shows the RBAC to add. To name you in the binding, Krust can ask the cluster who you are with one read-only SelfSubjectReview, or you can type your user or group.
  4. Apply it in one of three ways:
    • Run It Yourself: Krust shows a server-side dry run, then the command that applies it.
    • Ask Your Agent: copy a prompt for Claude Code or another agent signed in to this cluster. It previews first and asks you before applying.
    • Send to an Admin: share the YAML file. It already names you.
  5. Verify. Krust sends four read-only requests with your credential, one at a time, and shows the kubectl command that asks the same question. The first asks as you; the other three ask as krust-agent.

Krust never creates, changes or deletes RBAC on your cluster. It only reads, to check the result. The commands use kubectl create, so they only add what's missing: parts a teammate already added show as AlreadyExists, and that's fine.

kubectl --context my-cluster create --dry-run=server -f krust-agent.yaml
kubectl --context my-cluster create -f krust-agent.yaml

What gets added

Seven RBAC objects, all labelled app.kubernetes.io/managed-by: krust. Six are shared by everyone on the cluster who uses Krust:

The seventh is your own binding to the impersonator role. Krust shows the full file, with a comment on each object, before you apply anything. Kubernetes RBAC for AI agents has the whole file and the ways to narrow it.

Verify

Verify asks the cluster four questions. You can run the same ones yourself:

QuestionAsked asExpected
1. Who the cluster says you areYouYour user
2. Krust's setup is on the clusterkrust-agent, read groupyes
3. Claude can't change workloads unless Krust lets it throughkrust-agent, read groupno
4. Even an approved change can't change RBACkrust-agent, both groupsno
# 1
kubectl auth whoami
# 2
kubectl auth can-i get /krust-agent-identity \
  --as=krust-agent --as-group=krust:agent-read
# 3
kubectl auth can-i create pods -A \
  --as=krust-agent --as-group=krust:agent-read
# 4
kubectl auth can-i create clusterrolebindings.rbac.authorization.k8s.io -A \
  --as=krust-agent --as-group=krust:agent-read --as-group=krust:agent-write

In the app, each command already names the cluster's context, and Copy All Commands copies them together.

Krust asks the last three again whenever a Claude tab opens on the cluster. The status shows in the Claude bar and in Settings:

Least-privilege RBAC for platform teams

You don't have to apply Krust's file as it is. Grant krust-agent with Helm, Argo CD or your own roles, as long as you keep its names and two rules hold: the read group alone can't create pods, and both groups together can't create ClusterRoleBindings. Kubernetes RBAC for AI agents lists the names, the full YAML, per-namespace writes, keeping Secrets from the agent and team-wide bindings.

Claude Code with --dangerously-skip-permissions

--dangerously-skip-permissions turns off Claude Code's own prompts before it runs a command. It doesn't change what reaches your cluster: kubectl and helm in the tab still go through Krust's proxy, which checks the tab's mode, and with cluster enforcement the API server still authorizes each request as krust-agent. A command Claude runs without asking you can still do only what krust-agent's groups allow.

It doesn't make the rest of your Mac safe. The flag also skips the prompts for files and other commands, and a kubeconfig or cloud CLI sign-in on disk still reaches the cluster as you. Claude Code --dangerously-skip-permissions: what your cluster still refuses covers the flag in more detail.

What this does not cover

FAQ

Can Claude Code delete a production database?

Not from a Read-only tab: Krust refuses the delete, and on a cluster-enforced cluster the API server refuses it too, because the read group can't delete anything. In Ask, a delete waits for your approval; once you approve, it runs with the write group's access, the built-in edit role by default, which can delete a StatefulSet or a PersistentVolumeClaim in the namespaces it covers. To keep a namespace out of reach, bind the write group only where Claude may change things. See Kubernetes RBAC for AI agents.

Does Claude get a token for krust-agent?

No. There is no separate credential. Krust's proxy sends Claude's requests with your credential and the impersonation headers, and the tab only ever holds a proxy token that the cluster doesn't accept.

Can one krust-agent serve the whole team?

Yes. The shared roles are applied once; each person, or a group subject for a whole team, gets the impersonator binding. Everyone's Claude tabs then have the same krust-agent limits, and the audit log still shows who each request was for.

What if someone changes the RBAC later?

Krust asks again when a Claude tab opens. If the setup is gone, Claude's requests reach the cluster as you, limited by Krust's checks, and the bar says so. If it has become too broad, Krust stops using krust-agent and shows why.