Service Proxy for Kubernetes Provider
You set up a service proxy for kubernetes provider workflows by routing API calls through a central control point. This setup pairs with native role rules to check every cluster request. Many teams start by handing out broad cluster roles to speed up daily work. Those wide permissions let one bad command break live apps across the whole cluster. How a service proxy for kubernetes provider works with RBAC Kubernetes manages permissions through its built-in role-based system on the API server.
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 a service proxy for kubernetes provider workflows by routing API calls through a central control point. This setup pairs with native role rules to check every cluster request. Many teams start by handing out broad cluster roles to speed up daily work. Those wide permissions let one bad command break live apps across the whole cluster.
How a service proxy for kubernetes provider works with RBAC
Kubernetes manages permissions through its built-in role-based system on the API server. You enable this authorization mode directly on the API server at startup. Every rule you write is additive, and the system has no deny rules. You start with zero access and add explicit rules for each needed action.
A standard Role sets permissions inside one single namespace for your team. A ClusterRole is not tied to one namespace and covers cluster-wide objects like nodes. It can also cover non-resource endpoints or namespaced objects across all namespaces at once. To grant these permissions to users, you create a binding object in the cluster.
A RoleBinding grants permissions inside one namespace and can point to a Role there. A RoleBinding can also reference a shared ClusterRole to keep rules consistent in one namespace. A ClusterRoleBinding grants permissions across the entire cluster at once for broader tasks. The system matches resource names in your rules to the exact API URL path.
Some API calls target a subresource like pod logs or pod command execution. In your role rules, you write these subresources using a slash after the main resource. This lets admins separate basic pod reading from direct shell execution inside running containers.
Where native Kubernetes role rules fall short
Native roles and bindings do a good job of deciding who can reach the API. They let you limit which namespaces a developer can view or change during work. You can also separate read access for pod logs from write access for deployments. This gives your team a solid base for cluster security and basic compliance.
Still, native authorization stops checking once the API server approves the initial request. When a user gets permission for the pod exec subresource, they open an interactive shell. Kubernetes does not inspect the individual shell commands that run inside that container session. A user with exec rights can read local files or change app state unchecked.
Database Proxy (ProxySQL, PgBouncer) + Kubernetes RBAC: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Native rules also have limits when you restrict creation calls to specific resource names. The resource name filter on create actions applies only to top-level resources, not subresources. This makes fine-grained control over subresource actions hard to manage with native roles alone. Teams also struggle when static client credentials sit on laptops without per-command checks.
Planning your namespace and subresource rules
Start your setup by mapping each team to the specific namespaces they actually run. Use a Role and a RoleBinding when a team only works in one namespace. If several teams need the same permissions in separate namespaces, define one reusable ClusterRole. Then bind that ClusterRole inside each target namespace using a local RoleBinding object.
Avoid using a ClusterRoleBinding unless a person or service truly needs cluster-wide reach. Split your subresource rules so that pod log reading stays separate from pod exec. Only grant pod exec rules when a task requires direct shell commands inside a container. Keep your role definitions small and review every binding on a regular schedule.
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 I write a deny rule in Kubernetes RBAC to block specific pods?
No, Kubernetes RBAC rules are purely additive and do not support deny rules. You must start with minimal permissions and grant only the exact actions a user needs.
How do RoleBinding and ClusterRoleBinding differ in scope?
A RoleBinding applies permissions within one specific namespace, even if it references a ClusterRole. A ClusterRoleBinding grants permissions across all namespaces and cluster-scoped resources at the same time.
Why do pod logs and pod exec need separate RBAC rules?
Kubernetes treats logs and exec as subresources written with a slash in the API path. Listing them separately lets you allow log reading without granting shell execution inside pods.
Related guides
In this post