Service Proxy for Kubernetes Program
You build a service proxy for kubernetes program by pairing network routing with role rules. First, you set up API server permissions and bind users to specific namespaces. Most engineering teams start by granting broad cluster roles to get apps running fast. Broad roles let developers run any command across every pod in the cluster. That wide permission scope creates big security risks when someone runs a bad command. How a service proxy for kubernetes program works Kubernetes controls clust
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 build a service proxy for kubernetes program by pairing network routing with role rules. First, you set up API server permissions and bind users to specific namespaces. Most engineering teams start by granting broad cluster roles to get apps running fast. Broad roles let developers run any command across every pod in the cluster. That wide permission scope creates big security risks when someone runs a bad command.
How a service proxy for kubernetes program works
Kubernetes controls cluster actions through its built-in role-based permission system. This system uses the standard authorization API group on the API server. You enable this mode directly on the API server at startup. Every permission rule in this model is additive. There are no deny rules in native Kubernetes roles. You start with zero access and add rules for each needed action.
A Role sets permissions inside one single namespace. A ClusterRole is not tied to one namespace. It can cover cluster-wide resources like nodes or apply across all namespaces. To give these rules to a user, you create a binding. A RoleBinding grants permissions inside one specific namespace. It can point to a local Role or a shared ClusterRole. A ClusterRoleBinding grants permissions across the whole cluster at once.
Managing pod subresources and command execution
Teams often use a service proxy for kubernetes program to reach internal pods. Kubernetes treats pod logs and command sessions as subresources in the API URL. In your role rules, you write these subresources using a forward slash. For example, reading pod logs requires permission on the pods log subresource. Opening a shell inside a container requires permission on the pods exec subresource.
Admins try to limit these rules to specific pod names using resource name lists. Still, native resource name restrictions on create actions only work on top-level resources. They do not block create requests on subresources in the way many teams expect. Once a user has exec permissions in a namespace, they can enter any pod there.
Database Proxy (ProxySQL, PgBouncer) + Kubernetes RBAC: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
What native roles solve and what keeps the session active
Native roles and bindings do a good job of gatekeeping at the cluster door. They verify who can call the API server and which namespace they can reach. Separating duties with namespace bindings stops one team from changing another team's apps. It gives you a clear map of which groups hold cluster-wide rights.
Still, native role rules stop checking once the pod session opens. The API server checks if a user can start an exec session. It does not check the shell commands run inside that session. A developer inside a pod can read local files or query attached databases. They might pull raw emails, phone numbers, card numbers, or national IDs from app memory. Native roles cannot rewrite matched fields in results or block one risky shell command 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 must remove the binding or build a smaller role to take away permissions.
What is the difference between a RoleBinding and a ClusterRoleBinding?
A RoleBinding applies permissions inside one single namespace. A ClusterRoleBinding applies permissions across every namespace and cluster resource.
How does Kubernetes control access to pod logs and shell sessions?
Kubernetes uses subresources written with a slash in the role rule. You grant access to the log or exec subresource under the main pods resource.
Related guides
In this post