How to Configure Cline Kubernetes Read Only Access

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up cline kubernetes read only access by binding a view role to a dedicated identity. Then you point the AI coding agent to that restricted cluster profile. Most teams start by sharing their own local cluster config with the agent. That quick setup gives the agent the same broad rights as a human engineer. If a human can delete workloads or read secrets, the agent can too. A safe setup gives the agent its own identity with strict read rules. How to set up cline kubernetes read only acce

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 cline kubernetes read only access by binding a view role to a dedicated identity. Then you point the AI coding agent to that restricted cluster profile. Most teams start by sharing their own local cluster config with the agent. That quick setup gives the agent the same broad rights as a human engineer. If a human can delete workloads or read secrets, the agent can too. A safe setup gives the agent its own identity with strict read rules.

How to set up cline kubernetes read only access with native RBAC

Kubernetes uses Role-Based Access Control to manage what users and workloads can do. In this model, rules are purely additive, and there are no deny rules. You start with zero rights and add only the actions the agent needs. A Role sets permissions inside one namespace. A ClusterRole sets permissions across all namespaces or for cluster-wide items like nodes.

To grant read rights, you create a Role or ClusterRole that allows read verbs. These verbs let the identity list and view pods, services, and deployments. You must also pay attention to subresources in the API. Kubernetes treats pod logs as a subresource under the pod object. If you want the agent to debug apps, you must allow access to the log subresource. At the same time, you leave out the exec subresource so the agent cannot open a shell.

Once you define the role, you link it to an identity with a binding. A RoleBinding grants those permissions inside a single namespace. A ClusterRoleBinding grants the permissions across the whole cluster. When the coding agent runs a command in the local shell, it uses this bound identity. The cluster API server checks the binding and rejects any write or delete request.

What native roles solve and what they leave open

Native cluster roles are great at stopping changes to your cluster state. A read-only binding blocks the agent from deleting pods or scaling down deployments. It also stops the agent from creating new workloads or changing service routes. For basic cluster safety, native RBAC is a strong first step.

Still, native RBAC only checks who logs in and which API resource they request. It does not inspect the content that returns from a read request. When an agent reads pod logs or config maps, those outputs often hold private data. Customer emails, phone numbers, card numbers, or national IDs often show up in app logs. Once the agent reads a log stream, that raw data goes straight to the model provider.

Auditor Read-Only Access + Kubernetes API Server Access: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Static credentials on a laptop also create a tracking problem for security teams. Many engineers share one read-only cluster key or use their own cloud login. In the cluster audit log, agent commands look just like human commands. Teams cannot tell which prompt caused a read spike or which user ran a check. Plus, static keys sit on disks where other local tools can read them.

Managing sensitive data and audit trails for AI agents

To close these gaps, teams need controls that work on individual requests in flight. Read-only access should not mean full access to raw production secrets or user data. Data masking rewrites matched fields like emails or card numbers in results before the agent gets them. This lets the agent read log errors and fix bugs while keeping personal data safe.

Teams also need to tie every cluster check back to an individual user identity. Instead of storing static cluster keys on laptops, the workflow should check identity on each run. Every command and log read should link to a clear audit entry. Security teams can then review what the agent asked for and what the cluster returned.

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

Can a Kubernetes Role explicitly deny access to one specific resource?

No, Kubernetes RBAC rules are purely additive and do not support deny rules. To block access to secrets, you must leave secrets out of the allowed resource list.

Should I use a RoleBinding or a ClusterRoleBinding for an AI coding agent?

Use a RoleBinding when the agent only needs to check apps in one namespace. You can bind a shared read ClusterRole to one namespace using a RoleBinding.

Why can the agent view pods but fail to read pod logs?

Kubernetes treats pod logs as a separate subresource in the API. Your role must grant read permissions to the pod log subresource, not just the pod resource.

The query runs. The emails stay hidden.