How to Configure Cursor Kubernetes Read Only Access
You set up cursor kubernetes read only access by binding a viewer role to a dedicated identity. Then you point the AI editor to a local cluster file that uses that restricted role. Most teams start by sharing a developer's existing cluster file with the editor. That shortcut gives the AI assistant the same broad rights as the human engineer. If a prompt goes wrong, an overly broad role can delete workloads or change live state. How cursor kubernetes read only access works in RBAC Kubernetes r
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 cursor kubernetes read only access by binding a viewer role to a dedicated identity. Then you point the AI editor to a local cluster file that uses that restricted role. Most teams start by sharing a developer's existing cluster file with the editor. That shortcut gives the AI assistant the same broad rights as the human engineer. If a prompt goes wrong, an overly broad role can delete workloads or change live state.
How cursor kubernetes read only access works in RBAC
Kubernetes role-based access control uses rules to define what a user or tool can do. Every rule in this system is additive, which means there are no deny rules. You start with zero rights and add only the specific actions the editor needs. For a safe setup, you allow read actions like get, list, and watch on workloads.
You can scope these read rules to one namespace or across the whole cluster. A standard role sets permissions inside a single namespace for focused work. A cluster role covers cluster-wide objects like nodes or spans across all namespaces at once. A role binding then links those read rules to the user or service account. When the AI editor runs a command, the API server checks this binding first. If the action asks to change or delete a pod, the server blocks the request.
How the AI editor reaches your cluster
AI coding tools reach external systems like clusters through local shell tools or protocol servers. When you ask the editor to check a failing pod, it runs a command locally. That command reads the local cluster config file stored on the engineer's laptop. The cluster config file holds the user identity, the server address, and the secret token.
To keep the editor restricted, teams create a separate context inside that local file. This context points to the read-only identity instead of the engineer's main admin account. The editor uses this restricted context to read pod status, events, and deployment specs. It can inspect the cluster state and suggest fixes in your code files. It cannot apply those changes to the live cluster on its own.
Auditor Read-Only Access + Kubernetes API Server Access: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
What native read roles solve and what they miss
Native cluster roles stop the AI tool from deleting pods or editing live deployments. They draw a clear line between reading state and changing state at the API level. For basic status checks on deployments and services, native role bindings work well.
Still, static read roles still leave major security gaps open during daily work. First, read access often includes subresources like pod logs or secret objects in a namespace. Pod logs frequently contain raw emails, phone numbers, card numbers, or national IDs from live traffic. A standard read role lets the editor pull those sensitive strings straight into the prompt context. Second, storing static cluster keys on every laptop creates a key management problem. Anyone or any local process on that machine can read and reuse that credential file. Finally, cluster audit logs only show that the shared read account listed pods or logs. They do not link each cluster request back to a specific prompt or approval step.
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 a Kubernetes role explicitly deny access to secrets while allowing other reads?
No, Kubernetes role rules are purely additive and do not support deny rules. To block secrets, you must leave secrets out of the allowed resource list in your role.
How do subresources like pod logs work in a read-only role?
Kubernetes treats pod logs as a subresource written with a slash in the rule definition. You must grant read rights to both the pod resource and the pod log subresource.
Why is sharing a developer kubeconfig with an AI agent risky?
A developer config often holds write permissions or broad read rights across many namespaces. The AI tool inherits every permission in that file when it runs shell commands.
Related guides
In this post