How to Configure Aider Kubernetes Read Only Access
You set up aider kubernetes read only access by binding a dedicated Kubernetes role to your coding assistant's user account. That role grants only view verbs like get and list on specific cluster resources. Many teams start by running Aider in a local shell that already holds cluster admin credentials. When an AI coding tool uses broad permissions, one bad command can delete pods or leak secrets. How to set up aider kubernetes read only access with RBAC Aider runs in your terminal and execute
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.
You set up aider kubernetes read only access by binding a dedicated Kubernetes role to your coding assistant's user account. That role grants only view verbs like get and list on specific cluster resources. Many teams start by running Aider in a local shell that already holds cluster admin credentials. When an AI coding tool uses broad permissions, one bad command can delete pods or leak secrets.
How to set up aider kubernetes read only access with RBAC
Aider runs in your terminal and executes shell commands when you ask it to inspect or fix problems. When Aider runs a cluster tool, that tool uses whatever kubeconfig file is active in your shell. To limit what Aider can do, you must give its shell a separate Kubernetes identity.
Kubernetes role-based access control uses roles and bindings to manage permissions. A Role sets permissions inside one single namespace. A ClusterRole sets permissions across the whole cluster or on cluster-wide objects like nodes. In Kubernetes RBAC, rules are purely additive, and there are no deny rules. You start with zero access and add only the exact read rules you need.
First, create a Role in the target namespace for your coding assistant. In that Role, list only safe read verbs for pods, deployments, and services. You can also include the pod log subresource so Aider can read app logs during a debugging session. Leave out write verbs like create, update, patch, and delete.
Next, create a RoleBinding in that same namespace. The RoleBinding links your read-only Role to the dedicated identity that Aider will use. If Aider needs to check resources across every namespace, you can use a ClusterRole and a ClusterRoleBinding instead. Still, scoping access to a single namespace is much safer for daily tasks.
Finally, point Aider's shell session to a kubeconfig profile that authenticates as this restricted identity. When Aider runs a command to check pod status, the Kubernetes API server checks the RoleBinding. The API server allows read requests and blocks any attempt to change or delete cluster state.
What native RBAC solves and what it leaves open
Native Kubernetes RBAC is great at blocking destructive state changes at the API server level. With a strict read-only Role, Aider cannot delete a deployment, scale down a replica set, or edit a config map. It also stops the agent from opening an interactive shell inside a running container if you leave out the pod exec subresource.
Auditor Read-Only Access + Kubernetes API Server Access: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Still, static RBAC only decides which resource types an identity can read upon login. It cannot inspect the content of the data returned by a read command. If a Role allows reading config maps or secrets, Aider can fetch every field inside those objects. Even pod logs and environment dumps often hold sensitive data like emails, phone numbers, card numbers, or national IDs.
When Aider reads those logs or objects, the raw text flows straight into the language model prompt. Static RBAC also requires you to maintain long-lived kubeconfig files on every engineer's laptop. Also, basic RBAC does not pause risky commands for human approval or rewrite sensitive fields in results.
Best practices for scoping AI agent cluster permissions
Always omit the Secret resource type from any read-only Role you build for an AI assistant. Reading secrets gives the agent access to database passwords, API keys, and service tokens. If Aider needs to check whether a secret exists, check it yourself or inspect only the deployment spec that references it.
Avoid using built-in cluster roles that might include more resource types than you expect. Write a custom Role from scratch and list each resource group and verb by hand. Keep the pod exec subresource out of the Role as well. Executing commands inside a pod gives full container access even if the API call looks like a simple subresource request.
Check Kubernetes API requests and responses on the wire
Kubernetes RBAC decides who may call the API server. RBAC does not check response payloads or split listing Secret names from reading Secret values when a role grants get access. With hoop.dev, you run an open-source proxy, a sidecar for your Kubernetes API, inline on the API connection. On every kubectl or API call an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review.
On each call, hoop.dev guardrails read the method, normalized path, and headers to refuse bad deletes or full Secret reads with a 403 error, or hold risky calls for approval. On the way back, hoop.dev data masking walks JSON responses by key and masks matched values in Secrets, ConfigMaps, and pod logs in memory. View the project on GitHub.
Frequently asked questions
Can Kubernetes RBAC block Aider from deleting pods?
Yes, Kubernetes RBAC rules are purely additive and include no deny rules. If you only grant read verbs in your Role, the API server blocks all delete requests.
Should I give Aider a Role or a ClusterRole?
Use a Role and RoleBinding whenever possible to keep permissions inside one namespace. Only use a ClusterRole and ClusterRoleBinding when the agent must inspect resources across all namespaces.
How do I let Aider read pod logs without full pod control?
Grant read permissions on the pod log subresource inside your Role rules. Leave out the pod exec subresource so the agent cannot run commands inside containers.
Related guides
In this post