Join our Newsletter — 33% off our NHI Course

What is the difference between default deny ingress and default deny egress in Kubernetes network policies?

Default deny ingress blocks traffic coming into pods unless a rule explicitly allows it. Default deny egress blocks traffic leaving pods unless outbound access is approved. Used together, they create a stronger security baseline by limiting both inbound exposure and unauthorized outbound connections, including potential data exfiltration paths.

How Kubernetes treats ingress and egress as different trust boundaries

Ingress and egress are separated because they answer different questions about trust. Ingress controls whether a pod may accept connections from other pods, namespaces, or external sources. Egress controls whether that pod may initiate outbound connections to services, APIs, databases, or the internet. A default deny posture only becomes meaningful when you know which direction the policy is constraining and what traffic still needs explicit allowance.

In practice, this matters because Kubernetes network policies are additive and allow-list driven. A pod with default deny ingress can still make outbound requests unless egress is also restricted, and a pod with default deny egress can still receive traffic unless ingress is also blocked. That separation is what lets teams shrink exposure in one direction without accidentally breaking necessary system-to-system communication in the other.

For container and orchestrator risk, NIST SP 800-190 Container Security is the most direct external reference for understanding why those boundaries matter in runtime environments. CISA’s Secure by Design guidance also reinforces the same idea: safer defaults should reduce exposure before workloads are even deployed.

Why default deny ingress and default deny egress are used for different security outcomes

Default deny ingress is primarily about reducing the attack surface exposed to other workloads and to clients reaching the pod. It is the better control when the main concern is unsolicited inbound access, service enumeration, or lateral movement into a workload that should only accept tightly defined connections. Default deny egress is primarily about limiting what a pod can reach once it is running, which is important for preventing unauthorized outbound calls, command-and-control traffic, or data exfiltration.

Those different outcomes lead to different policy design choices. Ingress policies usually enumerate approved callers, namespaces, or application tiers. Egress policies usually enumerate approved destinations, ports, DNS behavior, or required platform services such as logging, identity, or package repositories. If you only set one direction, you are protecting only half of the communication path.

Where the issue involves containers, the most useful practical companion is Massive Docker Hub Secrets Leak because it shows how exposed workloads can become sensitive entry points when secrets are embedded in images. The broader credential and image-risk pattern is also covered in Docker Hub Auth Secrets in Container Images, which is relevant because an outbound path can turn a compromised pod into a secrets-exposure event.

Policy design errors, operational gaps, and what practitioners should watch

The most common mistake is assuming that default deny ingress automatically makes a workload safe. A pod that cannot be reached from the outside may still be able to call cloud metadata endpoints, exfiltrate data to an unexpected service, or pivot into other internal systems if egress remains open. The reverse mistake is equally common: teams block egress tightly but leave ingress broad, which can still permit arbitrary inbound probing and abuse.

Practitioners should also watch for policies that look restrictive but are effectively bypassed because they do not match the pods they were meant to protect, or because namespace labels and selectors are incomplete. In Kubernetes, a network policy only governs the pods it selects, so a policy design error can leave a workload in a permissive state even when the manifest appears defensive. The operational question is not just whether a policy exists, but whether it actually attaches to the intended pods and preserves required platform traffic.

For workload-identity and outbound-control context, SPIFFE workload identity specification is a useful companion when egress decisions depend on service-to-service trust rather than simple IP allow lists. At the policy level, OWASP API Security Top 10 is also relevant because unrestricted outbound API access can magnify broken authorization or data exposure problems once a pod reaches internal or external services.

Risk and Threat Considerations

Default deny ingress and default deny egress reduce different classes of exposure, but each one leaves a distinct failure mode if used alone. Ingress weakness mainly increases unauthorized access, lateral movement, and service abuse. Egress weakness mainly increases outbound data leakage, unauthorized dependency use, and the ability of a compromised pod to reach attacker-controlled infrastructure.

Failure mechanism: A policy may be correctly defined but incomplete, or it may only cover one traffic direction. That leaves either an open inbound path or an open outbound path, which adversaries can use for probing, persistence, command-and-control, or exfiltration.

Impact: The practical result is broader blast radius. Even a small compromise can become more serious when the pod can still communicate freely in the direction that matters most to the attacker’s goal.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

NIST CSF 2.0 and CIS Controls v8 set the governance and control requirements practitioners need to meet.

Framework Control / Reference Relevance
NIST CSF 2.0 PR.AC-3 — Remote Access is Managed Network policies manage allowed connectivity paths into and out of workloads.
PR.PT-4 — Communications and Control Networks are Protected Ingress and egress rules protect workload communications at the network layer.
DE.CM-1 — The Network Is Monitored to Find Potentially Adverse Events Egress restrictions work best with monitoring for unexpected outbound connections.
Recommendation — Constrain pod traffic paths to approved sources and destinations. Apply network filtering to separate approved inbound and outbound flows. Monitor for unusual pod destinations and denied outbound attempts.
CIS Controls v8 6.3 — Establish an Access Granting Process Default deny policies implement least-privilege network access by exception.
Recommendation — Grant only the network access each workload explicitly requires.

Practitioner Guidance

What to prioritise: Treat ingress and egress as separate controls with separate verification steps. If the workload handles sensitive data or has access to internal services, validate both directions, not just the one that seems more obvious for the application role.

What to verify: Confirm that each default deny policy actually selects the intended pods and that the remaining allow rules cover only the required destinations and sources. Test required platform traffic explicitly, including service discovery, logging, and any internal APIs the workload must reach.

Practitioner takeaway: The strongest posture comes from proving that a pod can only talk to the specific systems it must use, in both directions, and that every exception is deliberate and observable.