Kubernetes Route
A kubernetes route directs external or internal requests to the right service and pod. You set up a kubernetes route by defining network rules and role permissions. Most teams start by giving developers broad cluster roles to test network paths. Those broad roles often stay in place when apps move to production. Anyone with those permissions can change routes or run commands inside live pods. How to set up a kubernetes route with native roles To manage routing safely, you must use native Role
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 kubernetes route directs external or internal requests to the right service and pod. You set up a kubernetes route by defining network rules and role permissions. Most teams start by giving developers broad cluster roles to test network paths. Those broad roles often stay in place when apps move to production. Anyone with those permissions can change routes or run commands inside live pods.
How to set up a kubernetes route with native roles
To manage routing safely, you must use native Role-Based Access Control on the API server. This system uses a dedicated authorization API group to check every user request. Permissions in this system are purely additive, meaning there are no deny rules. You start with zero access and add rules for each needed action.
A Role sets permissions inside a single namespace for local routing objects. 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.
After you write the rules, you attach them to users or groups. A RoleBinding grants those permissions inside one specific namespace. That RoleBinding can point to a local Role or a shared ClusterRole. If a team manages routing across the whole cluster, you use a ClusterRoleBinding instead. This binding grants access across every namespace at once.
How subresources affect routing and pod checks
Setting up a route often requires checking pod logs or testing network paths inside containers. In Kubernetes, the API server treats logs and command execution as subresources. Role rules name these subresources using a slash, such as pods and log.
Engineers often want to run network checks from inside a running pod. Granting the exec subresource lets a user open a shell inside that container. You can restrict some permissions to specific resource names in your role rules. Still, resource name limits on create actions apply only to top-level resources, not subresources. Once a user has exec rights in a namespace, they can enter any pod there.
What native routing roles solve and what they miss
Native roles and bindings do a good job of controlling who can edit routing objects. You can limit who creates routes in a namespace and who views pod logs. This keeps unauthorized users from changing network rules on the API server.
Kubernetes RBAC: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Still, native role checks stop once the API server approves the initial request. The native setup decides who logs in, not what individual commands do in flight. If an engineer enters a pod to debug a route, Kubernetes does not check their shell commands. They could read local secrets or query internal databases from inside that pod. Also, pod logs and command outputs can print sensitive data like emails or card numbers. Native roles cannot rewrite matched fields in results before they reach the user screen.
Reducing risk when teams debug cluster traffic
To keep production safe, teams should split routing changes from live pod debugging. Keep RoleBindings tight so developers only manage routes in their own namespaces. Avoid using ClusterRoleBindings for daily network checks or app support tasks.
When engineers must run commands or check live data, add controls at the command level. Reviewing individual actions and masking sensitive fields in outputs closes the gap left by static roles.
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 to block changes to a specific kubernetes route?
No, Kubernetes role permissions are purely additive and do not support deny rules. To block access, you must grant a narrower RoleBinding that leaves out that object.
Should I use a Role or a ClusterRole for namespace routing?
Use a Role with a RoleBinding when the routing objects live in one namespace. You can also bind a shared ClusterRole to one namespace using a RoleBinding.
Why do engineers ask for pod exec permissions when fixing a route?
Engineers use the exec subresource to test network reachability from inside a specific pod. Because native roles cannot filter commands inside the pod, this permission carries high risk.
Related guides
In this post