How to Configure OpenHands Kubernetes Approval

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up openhands kubernetes approval by pairing agent confirmation prompts with scoped cluster roles. The agent pauses before it runs cluster commands, and a human reviews the request. Engineering teams often give coding agents broad cluster permissions to speed up daily tasks. This shortcut lets the agent read and change everything in the cluster right away. If the agent makes a mistake, it can delete live pods or read private data. Setting up strict roles and human checks stops bad comman

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 openhands kubernetes approval by pairing agent confirmation prompts with scoped cluster roles. The agent pauses before it runs cluster commands, and a human reviews the request.

Engineering teams often give coding agents broad cluster permissions to speed up daily tasks. This shortcut lets the agent read and change everything in the cluster right away. If the agent makes a mistake, it can delete live pods or read private data. Setting up strict roles and human checks stops bad commands before they cause outages.

How native openhands kubernetes approval and roles work

The setup starts inside the Kubernetes RBAC system on the API server. You create a Role to set permissions within a single namespace. If the agent needs cluster-wide reach, you create a ClusterRole instead. A ClusterRole can cover nodes or resources across every namespace in the cluster.

In Kubernetes, permissions are additive, which means there are no deny rules. You start with zero permissions and add only the exact actions the agent needs. Next, you link the agent identity to those rules. A RoleBinding grants permissions inside one namespace and can reference a Role or ClusterRole. A ClusterRoleBinding grants those permissions across the entire cluster at once.

You also have to watch how the agent interacts with pod subresources. Kubernetes RBAC names resources the same way they appear in the API URL. Subresources like pod logs or exec sessions use a slash in the rule definition. You must grant permissions for pod log reading and pod command execution as separate items.

On the agent side, you turn on confirmation mode for the runtime workspace. When the agent plans a cluster change, it stops and waits for a person. The operator reads the proposed command and approves or rejects the action.

What native controls solve and what they leave open

Native Kubernetes RBAC controls who can talk to the cluster API server. It blocks an agent from touching namespaces or resource types outside its assigned role. Meanwhile, the agent confirmation step gives a human a chance to check the plan. Together, they stop unapproved logins and basic accidents in test namespaces.

Approval Chains & Escalation + Kubernetes RBAC: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Still, static roles and local agent prompts leave a large operational gap in production. Kubernetes RBAC checks the resource type and verb, not the exact command content. Once a role allows pod exec sessions, the agent can run any shell command inside. The API server cannot tell a safe status check from a destructive script.

Also, local agent confirmation only works inside the developer's own coding workspace. It does not give security teams a central queue to review production requests. If an engineer turns off confirmation mode, the agent runs with full role permissions again. Native roles also cannot mask sensitive values like emails, phone numbers, or card numbers. If an agent reads pod logs or database outputs, raw data flows into the prompt.

Managing subresource permissions and team review workflows

To tighten this setup, teams split read roles from write and exec roles. You can give the agent a basic role that only lists pods and reads logs. This lets the agent check app health and find bugs on its own.

When the agent needs to edit a deployment or run a pod exec command, it stops. The team must review the exact command before granting a higher role or running it. Keep in mind that resource name restrictions in RBAC have limits on creation requests. Those restrictions apply to top-level resources, not to subresources during creation calls. Because of this, you cannot rely on resource name lists alone to lock down exec calls. Teams need a clear review step that inspects every command in flight.

Govern kubectl and API calls in flight

Identity providers and Kubernetes RBAC decide who logs into a cluster. They cannot redact keys inside returned JSON objects or hold a risky delete call for review. By design, hoop.dev runs as an open-source proxy, a sidecar for your Kubernetes API, checking requests and responses without replacing RBAC.

First, hoop.dev guardrails refuse banned methods, paths, or headers before they run. Next, hoop.dev data masking rewrites sensitive keys in returned Secret, ConfigMap, and log responses in memory, and writes each decision to the audit trail. Explore the repo on GitHub.

Frequently asked questions

Can Kubernetes RBAC block specific commands inside an exec session?

No, Kubernetes RBAC only checks if the user can start an exec subresource call. Once the session starts, RBAC cannot inspect or filter the shell commands inside the container.

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

Use a RoleBinding whenever possible because it limits the agent to one specific namespace. A ClusterRoleBinding gives access across the whole cluster, which increases risk if the agent errs.

Can I write a deny rule in Kubernetes RBAC to block deletions?

No, Kubernetes RBAC rules are additive and do not support deny rules. To block deletions, you must leave the delete verb out of every role bound to the agent.

The query runs. The emails stay hidden.