How to Configure AKS Namespace Isolation
You set up aks namespace isolation by combining Kubernetes RBAC roles with network policies. This setup keeps teams inside their own logical slice of a shared cluster. Many teams share one cluster to save money and reduce upkeep. When roles are too broad, one team can change or break another team's apps. Clear boundaries stop bad updates and limit damage if an account gets compromised. How aks namespace isolation works with RBAC Kubernetes RBAC controls who can read or write objects inside th
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 aks namespace isolation by combining Kubernetes RBAC roles with network policies. This setup keeps teams inside their own logical slice of a shared cluster. Many teams share one cluster to save money and reduce upkeep. When roles are too broad, one team can change or break another team's apps. Clear boundaries stop bad updates and limit damage if an account gets compromised.
How aks namespace isolation works with RBAC
Kubernetes RBAC controls who can read or write objects inside the cluster API. In RBAC, rules are additive, which means there are no deny rules. You start with zero access and add rules for each group or user. A Role sets permissions inside one single namespace. A ClusterRole sets permissions across the whole cluster or for cluster-scoped items like nodes.
To grant access, you link a role to a user or group. A RoleBinding grants permissions inside one namespace. You can point a RoleBinding at a local Role or a shared ClusterRole. Pointing a RoleBinding at a ClusterRole lets you reuse one template across many namespaces. A ClusterRoleBinding grants access across every namespace at once, so use it with care.
RBAC also covers subresources like pod logs and pod exec sessions. The API names these with a slash after the main resource name. If you grant pod exec rights, users can open a shell inside running containers. Teams must scope these subresource rules with care to keep namespaces separate.
Adding network and resource boundaries to namespaces
RBAC only checks API calls made to the cluster control plane. It does not stop pods in different namespaces from talking over the network. By default, pods in any namespace can send traffic to pods in other namespaces. To fix this, you must add network policies to each namespace. A default deny policy blocks cross-namespace traffic unless you add an allow rule.
You also need resource quotas and limit ranges in every shared namespace. Without quotas, one broken app can eat all the CPU and memory on nodes. That starves apps owned by other teams on the same cluster. Quotas cap the total compute and storage one namespace can claim.
K8s Namespace Isolation + AKS Managed Identity: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
What native isolation solves and what it misses
Native namespace controls do a great job of separating teams at the API level. RBAC decides who can log in and which namespace objects they can touch. Network policies and quotas keep pod traffic and hardware use inside fair limits. These controls form the base of any shared cluster setup.
Still, native setup stops at the door when a session begins. Once a role grants pod exec or port-forward rights, RBAC does not watch commands. It cannot block a risky shell command or mask sensitive data in outputs. If a pod prints emails, phone numbers, or card numbers, raw text flows back. Native RBAC also leaves teams managing local kubeconfig files and long-lived group bindings. Teams still need a way to check individual commands and rewrite sensitive fields 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
What is the difference between a RoleBinding and a ClusterRoleBinding?
A RoleBinding grants access inside one specific namespace only. A ClusterRoleBinding grants access across all namespaces and cluster-scoped objects like nodes. For namespace isolation, always prefer RoleBindings over ClusterRoleBindings for team access.
Can Kubernetes RBAC block a single user from one namespace?
No, Kubernetes RBAC rules are additive and do not support deny rules. To block a user from one namespace, remove their ClusterRoleBinding. Then grant them RoleBindings only in the namespaces they need to use.
Does RBAC stop pods from talking across namespaces?
No, RBAC only controls requests sent to the Kubernetes API server. Pod-to-pod network traffic keeps the session active across all namespaces by default. You must apply Kubernetes network policies to block traffic between namespaces.
Related guides
In this post