How to Configure Claude Code Kubernetes Approval
To set up claude code kubernetes approval, turn on manual mode for shell commands. You also bind strict cluster roles to the agent identity. Teams often let AI agents run cluster tools using a developer's own admin keys. This shortcut speeds up local tests at first. Still, broad permissions let a single bad command delete workloads or expose private data. A safer setup pairs local prompt checks with tight cluster role rules. How claude code kubernetes approval works in practice Claude Code re
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
To set up claude code kubernetes approval, turn on manual mode for shell commands. You also bind strict cluster roles to the agent identity. Teams often let AI agents run cluster tools using a developer's own admin keys. This shortcut speeds up local tests at first. Still, broad permissions let a single bad command delete workloads or expose private data. A safer setup pairs local prompt checks with tight cluster role rules.
How claude code kubernetes approval works in practice
Claude Code reaches external systems through its Bash tool and Model Context Protocol servers. In manual mode, the Bash tool asks for approval before it runs shell commands. Only a small built-in list of read-only file and git checks can skip this prompt. Every cluster command waits for a human to say yes on the local machine.
When the agent connects through an MCP server, it uses the credentials you provide. Vendor guides advise that you verify and trust each server before you use it. They also suggest read-only users so agent queries cannot change live data. On the cluster side, native access rules rely on Roles and ClusterRoles. A Role sets permissions inside one namespace. A ClusterRole can cover resources across all namespaces or cluster-wide nodes. You link these rules to an identity with a RoleBinding or ClusterRoleBinding. Because cluster permissions are only additive, there are no deny rules. You must start with zero rights and grant only the exact verbs the agent needs.
What native checks solve and what they miss
Local prompts and cluster roles solve the basic problem of who can log in. Manual mode stops the agent from running shell scripts in the background without notice. Narrow Roles stop an agent from touching namespaces outside its assigned scope. You can even split subresources like pod logs from pod exec rules. This lets an agent read app logs without the right to open a shell.
Yet this native setup leaves a major gap during daily work. Local approval happens on one user's laptop, not across a central team queue. Developers get tired of frequent pop-ups and often switch the agent to auto-run mode. Once an identity has a RoleBinding, the cluster allows every call that matches the verb. Native roles check the resource type, not the specific command arguments or payload in flight. If an agent has pod exec rights to debug an app, the cluster cannot filter what runs inside that shell. And if pod logs contain emails, phone numbers, or card numbers, native roles do not rewrite those fields in results.
Claude Code Security + Approval Chains & Escalation: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Designing a safer workflow for cluster agents
Start by creating a dedicated service account for the AI agent. Never let the agent share a human admin profile on a laptop. Bind that account to a Role in one test namespace with read verbs only. Keep write verbs and pod exec subresources out of the default role.
Next, separate routine read checks from risky changes. Let the agent read pod status and events through its narrow role. When the agent proposes a change or needs to run a script, require a peer check. Keep secrets out of the agent role so it cannot read raw keys. This split keeps fast reads safe while putting human eyes on every state change.
Add request guardrails and response masking beside Kubernetes
Cluster roles and service accounts govern who reaches the Kubernetes API. Still, a broad role or agent can delete workloads or print sensitive values from ConfigMaps and logs. In practice, hoop.dev sits inline beside the API server as a sidecar for your Kubernetes API. For every production API call an agent or human sends, hoop.dev decides whether to pass, mask, block, or escalate it for review alongside RBAC.
With hoop.dev Kubernetes controls, guardrails allow listing Secret names while refusing reads of Secret data before execution, and data masking redacts matched keys in returned JSON responses and log streams in memory. Furthermore, hoop.dev holds SOC 2 Type II and is MIT licensed on GitHub.
Frequently asked questions
Does Claude Code ask before it runs cluster commands?
Yes, when you use manual mode, the Bash tool pauses for user approval. Only a few built-in local read commands run without a prompt. If you connect through an MCP server, check how that server handles tool prompts.
Can Kubernetes RBAC block specific shell flags inside pod exec?
No, native cluster roles only check if an identity can call the exec subresource. Once the API server allows the call, RBAC cannot inspect the commands inside the container. You must withhold exec rights or check commands before they reach the cluster.
How should we restrict an agent to read-only cluster tasks?
Create a Role or ClusterRole that lists only read verbs for safe resources. Bind that role to a dedicated user or service account for the agent. Leave out write verbs, secret access, and exec subresources since RBAC has no deny rules.
Related guides
In this post