How to Configure Goose Kubernetes Permissions
You set up goose kubernetes permissions by linking the agent identity to native RBAC roles. You define what API actions the agent can run in a namespace or cluster. Many teams start by giving their AI agent broad cluster admin rights for testing. This quick shortcut creates big risks when the agent runs live commands on pods. A broad role lets the agent change workloads, read secrets, or delete key services. How goose kubernetes permissions work in native RBAC Kubernetes controls agent action
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 goose kubernetes permissions by linking the agent identity to native RBAC roles. You define what API actions the agent can run in a namespace or cluster. Many teams start by giving their AI agent broad cluster admin rights for testing. This quick shortcut creates big risks when the agent runs live commands on pods. A broad role lets the agent change workloads, read secrets, or delete key services.
How goose kubernetes permissions work in native RBAC
Kubernetes controls agent actions through its standard role-based API group on the API server. You build rules using either a Role or a ClusterRole object in your cluster. A Role always sets rules inside one single namespace for your agent to use. A ClusterRole is not tied to one namespace and covers cluster-wide items like nodes. It can also cover non-resource endpoints or namespaced items across all namespaces at once.
In Kubernetes, all permission rules are purely additive, which means there are no deny rules. You start with zero rights and add each allowed resource and verb by hand. After you write the rules, you bind them to the identity that Goose uses. A RoleBinding grants those permissions inside one chosen namespace for the local agent identity. A RoleBinding can point to a local Role or reuse a wider ClusterRole definition. If Goose needs cluster-wide reach, a ClusterRoleBinding grants that access across the whole cluster.
You also must account for subresources when you map out what Goose can do. Kubernetes RBAC names resources the exact same way they appear in the API URL. Some API calls target a subresource, such as reading pod logs or running exec. In RBAC rules, you write the subresource with a slash after the main resource. If you skip subresource rules, Goose cannot read logs or run commands inside containers. If you grant them broadly, the agent can run commands in every pod in scope.
What native RBAC solves and what it leaves open
Native Kubernetes RBAC does a good job of checking who can call an API. When Goose sends a request, the API server checks the bound Role or ClusterRole. If the verb and resource match a rule, the API server lets it through. This setup blocks unauthorized identities from touching namespaces or cluster nodes outside their scope. Teams use this to keep an agent inside one staging namespace during daily work.
Kubernetes RBAC + AI Agent Permissions: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Still, static RBAC only checks if the identity can use an API endpoint. It cannot inspect what happens inside an allowed session after the call starts. For example, once RBAC allows pod exec, Kubernetes does not filter the shell commands. Goose can run any script or tool that exists inside that target container. Similarly, if RBAC allows reading pod logs, the API returns all raw log lines. Native RBAC does not rewrite sensitive fields like emails, phone numbers, or card numbers. Also, local config files on a laptop often hold static keys for the cluster. Static RBAC decides who logs in, not what each command or output contains.
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 runs beside the API server as a sidecar for your Kubernetes API and checks every request and response alongside RBAC.
With hoop.dev Kubernetes controls, guardrails can allow listing Secret names while refusing reads of Secret data before execution. 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 I write a deny rule to block Goose from one sensitive pod?
No, Kubernetes RBAC rules are purely additive and do not support deny rules. You must grant only the exact resources and namespaces the agent needs to use.
Should I use a RoleBinding or a ClusterRoleBinding for Goose?
Use a RoleBinding when Goose only needs to work inside one single namespace. Use a ClusterRoleBinding only when the agent must check nodes or work across all namespaces.
Why can Goose list pods but fail to read their logs?
Pod logs are a subresource in the Kubernetes API and need their own rule. You must add the log subresource with a slash to your Role definition.
Related guides
In this post