How to Configure Devin Kubernetes Read Only Access

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up devin kubernetes read only access by creating a Kubernetes role with view rules and binding it to a dedicated identity. This setup lets the AI agent read cluster state and pod logs without changing active workloads. Engineering teams use AI software agents to debug broken apps and check pod health. When an app fails, the agent needs to check cluster events and read logs. Many teams take a shortcut and hand the agent a broad admin kubeconfig file. That quick fix creates a big risk for

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 devin kubernetes read only access by creating a Kubernetes role with view rules and binding it to a dedicated identity. This setup lets the AI agent read cluster state and pod logs without changing active workloads.

Engineering teams use AI software agents to debug broken apps and check pod health. When an app fails, the agent needs to check cluster events and read logs. Many teams take a shortcut and hand the agent a broad admin kubeconfig file. That quick fix creates a big risk for the whole team. If an agent holds write permissions, one bad command can delete a live workload. A scoped role stops the agent from changing or deleting cluster objects.

How native devin kubernetes read only access works

Kubernetes uses role-based access control to manage what users and agents can do. In this system, permissions are additive, and there are no deny rules. You start with zero permissions and add rules for each resource the agent needs. A Role sets permissions inside a single namespace for one specific team or app. A ClusterRole sets permissions across the whole cluster and covers nodes or all namespaces.

To build a safe view role, you list the resources the agent can inspect. Typical targets include pods, deployments, services, and events. You then limit the allowed verbs to read actions like get, list, and watch. Kubernetes also uses subresources that appear as a slash in the API path. To let the agent read app output, you must allow the pod log subresource. Without that rule, the agent can see pod status but cannot read log lines.

Once you define the role, you attach it to the agent identity. A RoleBinding grants those permissions inside one namespace. A ClusterRoleBinding grants the rules across every namespace in the cluster. You can bind a ClusterRole with a local RoleBinding to keep permissions inside one namespace. This lets you reuse one read definition across many projects without granting cluster-wide reach.

What native roles solve and where gaps remain

Native roles and bindings do a good job of stopping direct cluster changes. When the AI agent tries to delete a pod, the API server blocks it. The agent also cannot scale deployments or edit live service configs. If you leave secret objects out of the role, the agent cannot list stored keys.

Still, native role checks only decide who can call a resource endpoint. They do not inspect the content that flows back inside an allowed read request. When an agent reads pod logs, those logs often hold sensitive user data. A stack trace in a log might print emails, phone numbers, or card numbers. Because the agent has permission to read the log subresource, Kubernetes sends everything back. The native API server cannot rewrite matched fields in results before the agent reads them.

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 for the agent create another daily problem for platform teams. The agent needs a token or client certificate on its host machine to log in. If that key sits in a config file, anyone on that workspace can use it. Native roles also lack command-level approvals for rare tasks like running a pod check. Teams must either grant permanent exec rights or update role bindings by hand during incidents.

Scoping subresources and namespace boundaries

A strong setup keeps the AI agent inside the namespaces it needs to debug. You should avoid ClusterRoleBindings unless the agent must inspect nodes or global objects. Start by creating a dedicated namespace for staging or development workloads. Bind the agent identity only to that namespace so production apps stay out of reach.

Pay close attention to subresources when you write your role rules. Never include the pod exec subresource in a read-only role. Pod exec lets a user or agent run shell commands inside a running container. Even without cluster write rights, shell commands can change local files or read memory. Keep the role limited to metadata objects and the pod log subresource.

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 HTTP proxy, a sidecar for your Kubernetes API. The kubectl client changes only the server address it talks to while RBAC stays in place.

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. On the way back, hoop.dev data masking walks JSON responses by key and masks matched values in Secrets, ConfigMaps, and pod logs. Every request and verdict is logged without storing bearer tokens. View the project on GitHub.

Frequently asked questions

Can a Kubernetes Role include a rule to deny secret reads?

No, Kubernetes roles are additive and do not support deny rules. To block secret reads, you must leave the secrets resource out of every role bound to the agent.

How do I let Devin read pod logs without giving it shell access?

Grant get and list verbs on pods and on the pod log subresource. Do not include the pod exec subresource in the role definition.

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

Use a RoleBinding whenever possible to keep the agent inside one namespace. A RoleBinding can still reference a shared ClusterRole while limiting permissions to that single namespace.

The query runs. The emails stay hidden.