Controls that exist without doing what they promise
A cluster can have NetworkPolicies, Pod Security labels and “read-only” roles, and still let the important things through. Several Kubernetes controls fail silently: they exist without doing what their name promises.
They also protect each other in a chain. If you audit them separately and only check that they exist, the result gives a sense of security that does not match reality. This article follows the chain in order and suggests, for each link, how to check the effect.
*Scope:* this article covers the inside of the cluster. Access to the cluster through each cloud's IAM (Microsoft Entra ID and Azure RBAC, EKS access entries, Cloud IAM) is out of scope, and we have not reviewed it here.
Four controls that depend on each other
Think of one concrete goal: a compromised pod must not obtain cloud credentials using the node's identity. To achieve it you depend on four links:
1. Network. A NetworkPolicy stops the pod from reaching the provider's metadata endpoint. It only works if an engine enforces it.
2. Pod Security. A pod with hostNetwork: true shares the node's network and falls outside several of these protections (we see this in section 4). What prevents it is Pod Security Admission at the baseline or restricted level.
3. Namespace. Pod Security is configured with namespace labels, so whoever can modify them can relax it.
4. RBAC. Whoever has patch on the namespace can change those labels, according to the RBAC good practices guide.
An audit that ticks “NetworkPolicy: yes, Pod Security: yes, RBAC reviewed” can sign off a cluster in which any of the four links is broken. Let's take them one by one, with how to check that each one works, not just that it exists.
1. NetworkPolicy: existing does not mean being enforced
The official documentation puts it this way: creating a NetworkPolicy without a controller that implements it has no effect (Network Policies). The object is created, kubectl get networkpolicy shows it, and traffic keeps flowing.
On each provider, the engine depends on configuration:
| What to check | |
|---|---|
| EKS | The VPC CNI enforces NetworkPolicy only if enableNetworkPolicy is turned on. Standard and admin policies need version 1.21 or later. By default (*standard mode*), a new pod starts by allowing everything until the policies are applied to it. With NETWORK_POLICY_ENFORCING_MODE=strict it starts denying. It is only enforced on EC2 Linux nodes, not on Fargate or Windows, and for standalone pods without a controller it may not be enforced reliably (EKS network policy, configuration) |
| AKS | You have to choose an engine: Cilium, Azure NPM or Calico. With --network-policy none, policies exist but are not enforced. Azure NPM stops being supported on Linux nodes on 30/09/2028, and on Windows nodes it stopped being supported on 30/09/2026 (AKS network policies) |
| GKE | With GKE Dataplane V2, policy enforcement is built in and cannot be disabled, and Autopilot uses it by default. Without Dataplane V2 you have to enable both the NetworkPolicy add-on and its enforcement on the nodes (GKE network policy) |
Another limit of the API: the standard NetworkPolicy API does not allow default policies that apply to all namespaces, nor explicit denies. Policies are additive, and every pod that no policy selects accepts all traffic. So, if you only use NetworkPolicy, every new namespace is born open until someone adds its deny policy. Some engines offer cluster-scoped policies that cover this gap (on EKS, ClusterNetworkPolicy with VPC CNI 1.21 or later). If you use them, review them together with the namespace ones. The starting point from the documentation:
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: default-deny-all
namespace: tienda
spec:
podSelector: {}
policyTypes:
- Ingress
- EgressDenying egress also cuts DNS, as the documentation itself warns. You need an explicit policy:
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-dns
namespace: tienda
spec:
podSelector: {}
policyTypes:
- Egress
egress:
- to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: kube-system
podSelector:
matchLabels:
k8s-app: kube-dns
ports:
- protocol: UDP
port: 53
- protocol: TCP
port: 53If you use a DNS cache on the node (for example, LocalDNS on AKS, which can be enabled when you upgrade node pools to 1.37; we explain it in the article on upgrades), DNS traffic may not go to those pods. Check it in your cluster before you consider the policy done.
How to find which namespaces have no NetworkPolicy at all (requires bash):
comm -23 \
<(kubectl get ns -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}' | sort) \
<(kubectl get networkpolicy -A -o jsonpath='{range .items[*]}{.metadata.namespace}{"\n"}{end}' | sort -u)How to tell whether there is an engine:
# EKS (VPC CNI autogestionado o add-on)
kubectl get ds aws-node -n kube-system -o yaml | grep -- '--enable-network-policy=true' # sin salida = no se aplican políticas
aws eks describe-addon --cluster-name <cluster> --addon-name vpc-cni --query addon.configurationValues
# AKS
az aks show --resource-group <grupo> --name <cluster> --query networkProfile.networkPolicy -o tsv
# GKE con Dataplane V2:
kubectl -n kube-system get pods -l k8s-app=cilium # sin salida = no se aplican políticas
# GKE sin Dataplane V2:
kubectl get nodes -l projectcalico.org/ds-ready=true # sin salida = no se aplican políticas(“sin salida = no se aplican políticas” means “no output = policies are not enforced”.)
On AKS, none or an empty result means no policy is enforced. Even so, the definitive test is one of effect: two pods in a test namespace, a policy that should block traffic between them, and a connection attempt. The AKS documentation walks through it step by step.
2. Pod Security Admission: the Deployment gets in, the pods don't
Pod Security Admission (stable since 1.25) has three modes: enforce rejects the pod, audit records it in the audit log and warn alerts the user. The key is in this sentence from the documentation: audit and warn apply to workload resources, but enforce applies only to the resulting pods.
In practice: you apply a Deployment that violates restricted in a namespace with enforce, and kubectl apply finishes without errors. The Deployment exists, its ReplicaSet too, and there are no pods. The rejection only shows up in the ReplicaSet's events. If you do not have warn enabled, whoever deploys sees nothing. If it is the other way round and you have no enforce, you have warnings and nothing that blocks.
kubectl get events -A --field-selector reason=FailedCreate
kubectl get ns -L pod-security.kubernetes.io/enforce,pod-security.kubernetes.io/enforce-versionBefore tightening a level, the documentation suggests a server-side simulation that warns which current pods would violate it, without changing anything (apply standards with labels):
kubectl label --dry-run=server --overwrite ns --all pod-security.kubernetes.io/enforce=baselineOur criterion for policy versions is to pin enforce to the cluster version and leave warn and audit on latest. That way, the warnings tell you in advance what the next version will tighten, before it blocks anything:
apiVersion: v1
kind: Namespace
metadata:
name: tienda
labels:
pod-security.kubernetes.io/enforce: restricted
pod-security.kubernetes.io/enforce-version: v1.37
pod-security.kubernetes.io/warn: restricted
pod-security.kubernetes.io/warn-version: latest
pod-security.kubernetes.io/audit: restricted
pod-security.kubernetes.io/audit-version: latestBe careful with exemptions: the documentation warns that exempting controller service accounts (such as the ReplicaSet controller's) in practice exempts anyone who can create that kind of workload.
3. RBAC: the “read” permissions that are not
The RBAC good practices guide lists escalation paths that do not show up in a quick review of roles:
list and watch on Secrets reveal their contents, just like get.get on nodes/proxy is not read-only: it gives access to the kubelet API, which allows running commands in the pods on those nodes.escalate, bind and impersonate bypass RBAC's protections against escalation.create on serviceaccounts/token allows issuing tokens for existing accounts.patch on Namespaces allows changing their labels, including the Pod Security ones.system:masters group bypasses RBAC and is not revoked by deleting bindings.To audit, do not just read the roles: ask what each identity can do.
SA=system:serviceaccount:tienda:despliegue-ci
kubectl auth can-i --list -n tienda --as=$SA
kubectl auth can-i list secrets -n tienda --as=$SA
kubectl auth can-i get nodes --subresource=proxy --as=$SA
kubectl auth can-i patch namespaces --as=$SA
kubectl auth can-i create pods -n tienda --as=$SAAnd to find roles with escalation verbs (you will see noise from system roles, such as cluster-admin; review it anyway):
kubectl get clusterroles,roles -A -o json | jq -r '
.items[]
| select([.rules[]?.verbs[]?] | any(. == "escalate" or . == "bind" or . == "impersonate" or . == "*"))
| "\(.kind)\t\(.metadata.namespace // "-")\t\(.metadata.name)"'4. Workload identity: the pod that can inherit the node's identity
This is where the chain closes. Each provider handles pod access to node metadata differently:
169.254.169.254). The managed restriction (--enable-imds-restriction) is in preview, is not for production and is incompatible with several add-ons (AKS IMDS restriction). Meanwhile, the usual route is Microsoft Entra Workload ID for the pods plus an egress NetworkPolicy.metadata.google.internal and pods stop reaching the Compute Engine metadata server. Exception: pods with hostNetwork: true do not use Workload Identity and their requests go to the Compute Engine metadata server (GKE Workload Identity).For EKS and AKS, in namespaces that do not yet restrict egress:
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-egress-except-metadata
namespace: tienda
spec:
podSelector: {}
policyTypes:
- Egress
egress:
- to:
- ipBlock:
cidr: 0.0.0.0/0
except:
- 169.254.169.254/32Whether this policy really blocks traffic to 169.254.169.254 depends on the network engine, and the Kubernetes documentation does not guarantee it. Check it with the effect test at the end before you consider it closed.
Two traps. The first is that policies are additive: if another policy in the namespace allows 0.0.0.0/0 without except, the endpoint is open again. The second is that on GKE with Workload Identity you should not apply it like this, because pods get their credentials precisely through that metadata server.
And what connects to section 2: hostNetwork: true leaves the pod outside these protections on all three providers. On EKS, strict mode does not apply to pods on the host network. On AKS, the IMDS restriction does not affect them. On GKE, they do not use Workload Identity. In addition, the Kubernetes documentation defines NetworkPolicy behaviour with hostNetwork pods as “undefined”, and the most common implementation ignores them. That is why Pod Security at baseline or restricted, which do not allow hostNetwork, is part of identity control and not a separate topic.
Finally, if an application does not call the Kubernetes API, set automountServiceAccountToken: false. The RBAC guide recommends it, and the EKS guide suggests applying it to the default account of each namespace as well.
Common mistakes and how to detect them
| Mistake | How to detect it |
|---|---|
| NetworkPolicy with no engine to enforce it | The engine command for your provider, and an effect test with two pods |
| EKS in *standard mode* assuming pods start isolated | NETWORK_POLICY_ENFORCING_MODE variable on aws-node |
| Namespaces with no NetworkPolicy at all | The comm command above (a namespace whose policies do not select all its pods is still partly open) |
| Denying egress and breaking DNS | Resolution failures after applying default-deny-all in tests |
| A Deployment “deployed” with no pods because of Pod Security | FailedCreate events on ReplicaSets |
Namespaces with no enforce label | kubectl get ns -L pod-security.kubernetes.io/enforce |
“Read” roles with list on Secrets or get on nodes/proxy | kubectl auth can-i per identity |
| IMDS block cancelled by another, broader policy | Review all the namespace's egress policies together, not one by one |
Pods with hostNetwork in application namespaces | kubectl get pods -A -o jsonpath='{range .items[?(@.spec.hostNetwork==true)]}{.metadata.namespace}/{.metadata.name}{"\n"}{end}' |
Order of checks
First, read-only and in this order, because it follows the chain:
1. Network engine. Commands from section 1 for your provider.
2. Network coverage. Namespaces with no NetworkPolicy.
3. Pod Security. enforce labels per namespace and FailedCreate events.
4. hostNetwork. Pods on the host network outside kube-system.
5. RBAC. kubectl auth can-i for the CI/CD, operator and team identities, starting with patch namespaces, list secrets, nodes/proxy and create pods.
6. Identity. Node metadata configuration (IMDSv2 and hop limit on EKS; IMDS restriction or NetworkPolicy on AKS; Workload Identity on GKE).
Then, in a test namespace and outside production: an effect test of the NetworkPolicy between two pods, and a connection attempt to the metadata endpoint from a pod without hostNetwork. It should time out.
Where to start
1. Check that there is a NetworkPolicy engine. If there is not, your current policies protect nothing, and you want to know that as soon as possible.
2. List the namespaces with no deny policy and no enforce label: they are two gaps that repeat with every new namespace if nobody closes them.
3. Run kubectl auth can-i --list for your deployment pipeline's identity. By design it has broad write permissions, so it is the first one worth reviewing.
4. Decide how you block pods' access to the node identity on your provider, and test that the block works.
At Nubyron we work on Kubernetes security on AKS, EKS and GKE: RBAC, policies and hardening against the CIS guidance. If you would like us to review the whole chain in your cluster, get in touch.
Sources (accessed on 16/11/2026)
Command outputs are illustrative and were not captured from a real cluster. Each provider's options change: always check their documentation before acting.
Frequently asked questions
Why can a NetworkPolicy have no effect at all?
Because, according to the Kubernetes documentation, creating a NetworkPolicy without a controller that implements it has no effect: the object exists and traffic keeps flowing. On AKS, with network-policy none, policies exist but are not enforced; on EKS you have to turn on enforcement in the VPC CNI; on GKE, without Dataplane V2, you have to enable the add-on and its enforcement on the nodes.
What happens to a Deployment that violates Pod Security in enforce mode?
According to the documentation, enforce only acts on the resulting pods, not on the Deployment. kubectl apply finishes without errors, the Deployment and its ReplicaSet exist and there are no pods; the rejection shows up in the ReplicaSet's events. With warn enabled, whoever deploys gets a warning.
Can a “read-only” role be dangerous in Kubernetes?
Yes. According to the RBAC good practices guide, list and watch on Secrets reveal their contents just like get, and get on nodes/proxy gives access to the kubelet API. That is why it is worth asking what each identity can do with kubectl auth can-i, rather than only reviewing roles.
How do I check that a security control works, not just that it exists?
With an effect test: for example, two pods in a test namespace, a NetworkPolicy that should block traffic between them, and a connection attempt. For RBAC, kubectl auth can-i per identity. For Pod Security, the FailedCreate events on ReplicaSets.
Want us to review the chain of controls in your cluster?
We work on Kubernetes security on AKS, EKS and GKE: RBAC, policies and hardening against the CIS guidance. We can review your case with you and tell you where to start.
See Kubernetes security