Zero-Trust Default-Deny Network Policies
Start from default-deny and explicitly allow only required east-west flows.
In plain words
Default-deny is issuing no hallway keys at move-in and then granting each team only the doors its work proves it needs. The simple Kubernetes rule is: A zero-trust baseline selects all Pods with default-deny ingress and egress, then adds the minimum rules for DNS, platform endpoints, and observed service flows.
Think of it like…
Default-deny is issuing no hallway keys at move-in and then granting each team only the doors its work proves it needs.
Where you’ve seen it
During a connectivity incident, the network owner runs kubectl apply -f default-deny.yaml; kubectl get netpol -A. Expected evidence: A zero-trust baseline selects all Pods with default-deny ingress and egress, then adds the minimum rules for DNS, platform endpoints, and observed service flows. If the run instead shows this symptom, stop and restore the last known state: Allowing app-to-app traffic while forgetting UDP and TCP port 53 for CoreDNS leaves only a portion of connectivity functional.
Words you’ll hear
- Default-Deny
- For this lesson, Default-Deny is the controlling idea: A zero-trust baseline selects all Pods with default-deny ingress and egress, then adds the minimum rules for DNS, platform endpoints, and observed service flows.
- Zero Trust
- Zero Trust is the checkpoint; run
kubectl apply -f default-deny.yaml; kubectl get netpol -Aand inspect the owner chain. Allowing app-to-app traffic while forgetting UDP and TCP port 53 for CoreDNS leaves only a portion of connectivity functional. - Allowlists
- Allowlists is the outcome to preserve; the cost is explicit: Default-deny shrinks blast radius, but it creates an operational dependency on complete inventories, Git-reviewed allowlists, and policy-capable CNI behavior.
- Verification evidence
- The evidence command is
kubectl apply -f default-deny.yaml; kubectl get netpol -A. It connects the declaration to this behavior: Start from default-deny and explicitly allow only required east-west flows.
Visual diagram
Theory & deep dive
How Default-Deny reaches the intended state
Start from default-deny and explicitly allow only required east-west flows. A zero-trust baseline selects all Pods with default-deny ingress and egress, then adds the minimum rules for DNS, platform endpoints, and observed service flows.
The concrete checkpoint is kubectl apply -f default-deny.yaml; kubectl get netpol -A; compare the Default-Deny owner, Zero Trust state, and Allowlists outcome instead of treating YAML acceptance as proof.
Run kubectl apply -f default-deny.yaml; kubectl get netpol -A after the change and correlate the result with Events and the owning object. A zero-trust baseline selects all Pods with default-deny ingress and egress, then adds the minimum rules for DNS, platform endpoints, and observed service flows.
Zero Trust: failure boundary and production cost
Allowing app-to-app traffic while forgetting UDP and TCP port 53 for CoreDNS leaves only a portion of connectivity functional. The prerequisite contract is concrete: A zero-trust baseline selects all Pods with default-deny ingress and egress, then adds the minimum rules for DNS, platform endpoints, and observed service flows.
Default-deny shrinks blast radius, but it creates an operational dependency on complete inventories, Git-reviewed allowlists, and policy-capable CNI behavior. A safe design limits blast radius, records the last good configuration, and uses kubectl apply -f default-deny.yaml; kubectl get netpol -A as a deterministic rollback checkpoint.
Capture the current state with kubectl apply -f default-deny.yaml; kubectl get netpol -A, then correct the controlling manifest rather than patching a child object; the relevant divergence signal is specific: Allowing app-to-app traffic while forgetting UDP and TCP port 53 for CoreDNS leaves only a portion of connectivity functional.
How it works, step by step
Step 1 of 41. Define the reachability contract
Declare selectors, listeners, routes, or policy and keep endpoint readiness explicit: A zero-trust baseline selects all Pods with default-deny ingress and egress, then adds the minimum rules for DNS, platform endpoints, and observed service flows.
- Goal
- Start from default-deny and explicitly allow only required east-west flows.
- Owner
- Default-Deny
When to use it & trade-offs
What it is
Start from default-deny and explicitly allow only required east-west flows. A zero-trust baseline selects all Pods with default-deny ingress and egress, then adds the minimum rules for DNS, platform endpoints, and observed service flows.
Why it matters: Allowing app-to-app traffic while forgetting UDP and TCP port 53 for CoreDNS leaves only a portion of connectivity functional. The invariant at risk is specific: A zero-trust baseline selects all Pods with default-deny ingress and egress, then adds the minimum rules for DNS, platform endpoints, and observed service flows. The quickest fact check before changing the design is kubectl apply -f default-deny.yaml; kubectl get netpol -A.
When to reach for it
- Use Default-Deny to enforce this invariant: A zero-trust baseline selects all Pods with default-deny ingress and egress, then adds the minimum rules for DNS, platform endpoints, and observed service flows.
- Use Zero Trust evidence from
kubectl apply -f default-deny.yaml; kubectl get netpol -Ain reviews and incident timelines. Start from default-deny and explicitly allow only required east-west flows. - Choose the managed ingress or mesh route only when this cost is justified by governance or scale: Default-deny shrinks blast radius, but it creates an operational dependency on complete inventories, Git-reviewed allowlists, and policy-capable CNI behavior.
When to avoid or be careful
- Avoid assuming Default-Deny is complete after YAML submission; the required behavior is concrete: A zero-trust baseline selects all Pods with default-deny ingress and egress, then adds the minimum rules for DNS, platform endpoints, and observed service flows.
- Avoid treating the next symptom as random; check the owner and state with
kubectl apply -f default-deny.yaml; kubectl get netpol -Afirst: Allowing app-to-app traffic while forgetting UDP and TCP port 53 for CoreDNS leaves only a portion of connectivity functional. - Avoid adopting a heavier platform wrapper before measuring its cost: Default-deny shrinks blast radius, but it creates an operational dependency on complete inventories, Git-reviewed allowlists, and policy-capable CNI behavior.
Native, manual, and managed paths for Default-Deny
kubectl apply -f default-deny.yaml; kubectl get netpol -A.Strengths: A zero-trust baseline selects all Pods with default-deny ingress and egress, then adds the minimum rules for DNS, platform endpoints, and observed service flows.
Watch out: Default-deny shrinks blast radius, but it creates an operational dependency on complete inventories, Git-reviewed allowlists, and policy-capable CNI behavior. Recovery must also recognize this signal: Allowing app-to-app traffic while forgetting UDP and TCP port 53 for CoreDNS leaves only a portion of connectivity functional.
kubectl apply -f default-deny.yaml; kubectl get netpol -A; the expected invariant is: A zero-trust baseline selects all Pods with default-deny ingress and egress, then adds the minimum rules for DNS, platform endpoints, and observed service flows.Strengths: kubectl apply -f default-deny.yaml; kubectl get netpol -A gives immediate feedback without first building a platform layer.
Watch out: A manual change can hide drift, and unlike Default-Deny, it does not make this symptom self-documenting: Allowing app-to-app traffic while forgetting UDP and TCP port 53 for CoreDNS leaves only a portion of connectivity functional.
kubectl apply -f default-deny.yaml; kubectl get netpol -A.Strengths: Platform controls can wrap this exact behavior in policy or dashboards: A zero-trust baseline selects all Pods with default-deny ingress and egress, then adds the minimum rules for DNS, platform endpoints, and observed service flows.
Watch out: The added platform ownership buys value at this cost: Default-deny shrinks blast radius, but it creates an operational dependency on complete inventories, Git-reviewed allowlists, and policy-capable CNI behavior.
Interview signals & numbers to know
When this topic comes up
- Interview anchor: A zero-trust baseline selects all Pods with default-deny ingress and egress, then adds the minimum rules for DNS, platform endpoints, and observed service flows.
- Trace Default-Deny to Allowlists through Zero Trust; the invariant is: A zero-trust baseline selects all Pods with default-deny ingress and egress, then adds the minimum rules for DNS, platform endpoints, and observed service flows.
- Recognize the symptom: Allowing app-to-app traffic while forgetting UDP and TCP port 53 for CoreDNS leaves only a portion of connectivity functional.
- Justify the cost: Default-deny shrinks blast radius, but it creates an operational dependency on complete inventories, Git-reviewed allowlists, and policy-capable CNI behavior.
- Verify with kubectl apply -f default-deny.yaml; kubectl get netpol -A instead of only inspecting YAML.
Benchmarks & rules of thumb
- 53
- CoreDNS requires explicit port 53 UDP and TCP allows
- 2
- deny policies cover ingress and egress
- 0
- unlisted flows should be allowed in a mature baseline
Common mistakes & follow-ups
Common interview mistakes
- Debugging only the child object misses the Default-Deny owner contract: A zero-trust baseline selects all Pods with default-deny ingress and egress, then adds the minimum rules for DNS, platform endpoints, and observed service flows.
- Ignoring this telltale condition leads to unrelated changes: Allowing app-to-app traffic while forgetting UDP and TCP port 53 for CoreDNS leaves only a portion of connectivity functional.
- Repeating
kubectl apply -f default-deny.yaml; kubectl get netpol -Awithout an owner for remediation wastes retry cost. Default-deny shrinks blast radius, but it creates an operational dependency on complete inventories, Git-reviewed allowlists, and policy-capable CNI behavior.
Likely interviewer follow-ups
- How would API output and runtime evidence prove this behavior: A zero-trust baseline selects all Pods with default-deny ingress and egress, then adds the minimum rules for DNS, platform endpoints, and observed service flows?
- Which owner object, logs, and Events would you inspect for this symptom-Allowing app-to-app traffic while forgetting UDP and TCP port 53 for CoreDNS leaves only a portion of connectivity functional-?
- At what threshold would this cost become unacceptable: Default-deny shrinks blast radius, but it creates an operational dependency on complete inventories, Git-reviewed allowlists, and policy-capable CNI behavior?
kubectl apply -f default-deny.yaml; kubectl get netpol -A, name the failure, then justify the cost. Invariant: A zero-trust baseline selects all Pods with default-deny ingress and egress, then adds the minimum rules for DNS, platform endpoints, and observed service flows. Failure: Allowing app-to-app traffic while forgetting UDP and TCP port 53 for CoreDNS leaves only a portion of connectivity functional. Cost: Default-deny shrinks blast radius, but it creates an operational dependency on complete inventories, Git-reviewed allowlists, and policy-capable CNI behavior.Knowledge check
Put it into practice
Practice related interview Q&A
Apply Zero-Trust Default-Deny Network Policies with generative AI interview Q&A and hands-on practice.