Service Proxy for Kubernetes Solution
A service proxy for kubernetes solution directs user requests to internal cluster workloads. You set this up by combining API server routing with role-based permissions. Most teams start by giving engineers direct cluster roles to debug pods. When these roles are too broad, users gain wide permissions across every workload. A single mistake can then drop live tables or leak private keys. How a native service proxy for kubernetes solution works Kubernetes controls cluster traffic through its n
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.
A service proxy for kubernetes solution directs user requests to internal cluster workloads. You set this up by combining API server routing with role-based permissions. Most teams start by giving engineers direct cluster roles to debug pods. When these roles are too broad, users gain wide permissions across every workload. A single mistake can then drop live tables or leak private keys.
How a native service proxy for kubernetes solution works
Kubernetes controls cluster traffic through its native role-based permission system. An admin turns on this system at the API server level. The system uses four main objects to manage who can do what. A Role sets rules for one single namespace in the cluster. A ClusterRole sets rules across the whole cluster and all namespaces. It can also cover cluster-wide items like nodes or non-resource endpoints. All rules in this system are purely additive. There are no deny rules in native Kubernetes roles. You start with zero permissions and add rules one by one.
To give these permissions to a user, you create a binding. A RoleBinding grants permissions inside one specific namespace. It can link to a Role in that same namespace. A RoleBinding can also link to a global ClusterRole to save time. This lets admins reuse one set of rules across many teams. A ClusterRoleBinding grants permissions across the entire cluster at once. Teams use these bindings to let users reach pods and services.
Kubernetes also uses subresources for actions like reading logs or running commands. The API server writes these targets with a slash, like pods and log. Another common target is the pods and exec subresource for shell tasks. Admins must grant rights to these specific subresources in the role rules. Without them, a user can view a pod but cannot enter it.
What native roles solve and what they leave open
Native roles and bindings solve the first part of cluster security. They verify who can talk to the API server and which namespaces they reach. Admins can separate test workloads from live workloads using namespace bindings. They can also restrict who can read pod logs or start a shell.
Still, native roles only check requests when a session starts. Once the API server allows a shell or port forward, its job stops. The native system cannot see what commands a user runs inside a pod. If an engineer opens a shell, they can run any binary inside that container. They can query connected stores or read local files without further checks. Native roles also cannot filter out sensitive data from command output. If a pod log prints customer emails or card numbers, the user sees them. Also, managing hundreds of additive bindings across many clusters takes hours every week. Teams often take shortcuts and hand out wide ClusterRoleBindings during an outage. Those wide permissions rarely get removed after the fix is done.
Database Proxy (ProxySQL, PgBouncer) + Kubernetes RBAC: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Tightening pod and workload permissions
To reduce risk, teams should avoid giving out cluster-wide bindings to humans. Keep ClusterRoleBindings for system controllers that truly need global reach. Give human engineers namespace-scoped RoleBindings that only cover their own apps. Split read rules from write rules so debugging does not allow pod changes.
You should also restrict the exec subresource to a small group of responders. Most daily checks only require reading pod status and viewing logs. When someone does need shell rights, native roles still leave an visibility gap. Closing that gap requires checking commands and masking data in flight.
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?
No, native Kubernetes permissions are purely additive. You cannot write a rule that blocks a specific action from a broad role. Instead, you must build smaller roles that only grant the exact rights needed.
What is the difference between a RoleBinding and a ClusterRoleBinding?
A RoleBinding grants permissions inside one single namespace. A ClusterRoleBinding grants permissions across all namespaces and cluster-wide nodes at once. You can use a RoleBinding with a ClusterRole to keep permissions inside one namespace.
Why can users still run risky commands inside a pod with strict RBAC?
RBAC only checks if a user is allowed to open the pod exec subresource. Once the shell opens, Kubernetes does not check the shell commands run inside. Controlling inside-pod actions requires inspecting the session traffic in real time.
Related guides
In this post