Kubernetes Routing Rules
You set up kubernetes routing rules by defining network paths and role permissions in the cluster. These rules decide where traffic goes and which users can reach API endpoints. Platform teams often start with broad permissions to get apps running fast. Broad roles let too many users change live routing objects or open pod shells. A single bad change can break live traffic or expose private data across namespaces. How kubernetes routing rules and RBAC permissions work Cluster traffic manageme
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 kubernetes routing rules by defining network paths and role permissions in the cluster. These rules decide where traffic goes and which users can reach API endpoints. Platform teams often start with broad permissions to get apps running fast. Broad roles let too many users change live routing objects or open pod shells. A single bad change can break live traffic or expose private data across namespaces.
How kubernetes routing rules and RBAC permissions work
Cluster traffic management depends on two layers of control. The first layer directs external and internal network requests to the right services. The second layer controls which engineers or service accounts can edit those network paths. Native role-based control manages this second layer on the API server. You enable this authorization mode directly on the API server at startup.
In this system, a Role or ClusterRole holds rules that represent a set of permissions. All permissions in the cluster are additive, and there are no deny rules. A Role always sets permissions within a single namespace. A ClusterRole is not namespaced and can cover cluster-scoped resources like nodes. It can also cover non-resource endpoints or namespaced resources across all namespaces.
After you write the rules, you attach them to users with bindings. A RoleBinding grants permissions inside one namespace and can reference a Role or a ClusterRole. A ClusterRoleBinding grants permissions across the entire cluster. When a user sends a request, the API server checks these bindings against the target URL.
How subresources affect pod traffic and shell commands
Role rules refer to resources by the exact name that appears in the API URL. Some API calls use a subresource, such as reading pod logs or running a shell command. In RBAC rules, you write the subresource with a slash, like pods/log or pods/exec. Teams use these subresources to debug broken network paths inside running containers.
Granting access to subresources carries real risk if you do not scope it down. You can limit a rule to specific resource names for top-level objects. Still, the resource name limit on create calls applies only to top-level resources, not subresources. If a user can create a pod shell, they often get broad reach in that namespace. Anyone with that permission can run commands inside containers and inspect local network traffic.
Kubernetes RBAC + AWS Config Rules: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
What native cluster rules solve and what they miss
Native roles and routing objects solve the basic problem of who can reach the cluster API. They let you separate staging namespaces from production namespaces with clear boundaries. You can allow developers to read logs in one place while blocking edits to routing rules. This setup stops unauthorized users from deleting services or breaking ingress paths by accident.
Still, native setup only checks identity at the moment the API request arrives. It decides who logs in and which API endpoints they can call. It does not inspect what individual commands, statements, or requests do in flight. Once an engineer opens an interactive pod shell, native RBAC does not filter their shell commands. It also cannot mask sensitive fields like emails, phone numbers, card numbers, or national IDs in output. Teams need fine-grained command checks and data masking to keep live sessions safe.
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 I write a deny rule in native Kubernetes RBAC?
No, native permissions are purely additive and do not support deny rules. You must start with zero permissions and grant only the exact roles a user needs.
What is the difference between a RoleBinding and a ClusterRoleBinding?
A RoleBinding grants permissions inside one specific namespace, even if it references a ClusterRole. A ClusterRoleBinding grants permissions across every namespace and cluster-scoped resource in the cluster.
How do I control who can run commands inside a pod?
You control pod command execution by managing permissions for the pods/exec subresource in your roles. Only grant this subresource to users who need to run live commands inside containers.
Related guides
In this post