AKS Proxy

Published
Length
3 min read

Luis Felipe Dias

All posts

An aks proxy routes user traffic to your private Kubernetes API server over a secure path. You set it up to let engineers run cluster commands without exposing public endpoints. Teams often start by opening network paths and assigning default cluster roles to developers. When those roles are too broad, any user can read secrets or delete live workloads. A solid setup pairs network routing with tight Kubernetes role rules. How an aks proxy works with native Kubernetes roles Once network traff

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.

An aks proxy routes user traffic to your private Kubernetes API server over a secure path. You set it up to let engineers run cluster commands without exposing public endpoints.

Teams often start by opening network paths and assigning default cluster roles to developers. When those roles are too broad, any user can read secrets or delete live workloads. A solid setup pairs network routing with tight Kubernetes role rules.

How an aks proxy works with native Kubernetes roles

Once network traffic reaches the cluster API server, Kubernetes role-based rules take over. The API server checks every request against its built-in authorization API group. In Kubernetes, permissions are additive, which means there are no deny rules. You start with zero rights and add rules for each action a user needs.

A Role sets permissions inside one single namespace. For example, a developer Role might allow reading pods in a staging namespace. A ClusterRole is not tied to one namespace. It can cover cluster-wide items like nodes, or resources across all namespaces.

To give these permissions to a person, you create a binding. A RoleBinding grants the rules inside one specific namespace. Interestingly, a RoleBinding can point to a local Role or a broad ClusterRole. When it points to a ClusterRole, it shrinks those rules down to that single namespace. A ClusterRoleBinding grants permissions across the entire cluster at once.

Kubernetes also uses subresources for actions like reading pod logs or running a shell inside a pod. The API server writes these with a slash, separating the pod resource from the log or exec action. You must list these subresources in your Role if users need to debug running containers.

What native cluster rules solve and what they miss

Native roles and bindings solve the first part of cluster security. They verify who can talk to the API server and which API endpoints they can reach. A tight Role stops a developer in one namespace from deleting pods in another namespace. It also stops basic users from changing cluster-wide node settings.

Database Proxy (ProxySQL, PgBouncer) + AKS Managed Identity: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Still, native Kubernetes rules leave a large gap during live debugging. Once a Role allows the pod exec subresource, Kubernetes steps out of the way. The API server checks that the user can open the shell session. It does not check what commands the user types inside that shell.

Inside an active pod shell, an engineer runs with the permissions of the container process. They can read local files, inspect memory, or query databases that the pod talks to. If a database query returns customer emails, phone numbers, or card numbers, raw data prints to the screen. Native roles cannot rewrite matched fields in results or block a single dangerous shell command in flight.

Also, because Kubernetes permissions have no deny rules, fixing overly broad bindings takes careful work. You cannot write one rule to block secret reads if another binding already allows them. Teams must audit every RoleBinding and ClusterRoleBinding to remove excess rights by hand.

Planning namespaces and subresource rules for daily work

Good cluster hygiene starts by splitting workloads into clear namespaces by team or app. Give developers a RoleBinding in their own namespace rather than a ClusterRoleBinding. Let them view pods and pod logs by default so they can check app health.

Keep pod exec permissions separate from daily read roles. When an engineer needs to run commands inside a container, treat that action with extra care. Pairing namespace roles with command-level checks closes the gap that native Kubernetes rules leave open.

Add request guardrails and response masking beside Kubernetes

Cluster roles and service accounts govern who reaches the Kubernetes API. Still, a broad role or agent can delete workloads or print sensitive values from ConfigMaps and logs. In practice, hoop.dev runs beside the API server as a sidecar for your Kubernetes API and checks every request and response alongside RBAC.

With hoop.dev Kubernetes controls, guardrails can allow listing Secret names while refusing reads of Secret data before execution. Data masking redacts matched keys in returned JSON responses and log streams in memory. Furthermore, hoop.dev holds SOC 2 Type II and is MIT licensed on GitHub.

Frequently asked questions

Can a Kubernetes Role deny access to a specific pod or secret?

No, Kubernetes role rules are purely additive and never include deny rules. To block an action, you must remove the rule or binding that grants it.

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-scoped resources like nodes.

How does Kubernetes control who can read pod logs or open a shell?

Kubernetes treats logs and shell sessions as subresources written with a slash after the pod resource. You must add these specific subresources to a Role or ClusterRole to allow them.

The query runs. The emails stay hidden.