﻿# A policy named deny-egress can default to ingress isolation only

A practical investigation of a policy named deny-egress can default to ingress isolation only, with explicit observations, control cases and evidence limits.

Author: Retrivium team
Updated: 2026-11-06
Canonical URL: https://retrivium.ai/journal/field-security-networkpolicy-explicit-egress-isolation-direction/
Language: en

## The operational scenario

A deployment generator emits a NetworkPolicy with a model-worker selector and no permitted traffic rules. Its filename says deny-egress, so the release checklist treats outbound access as blocked. Yet an isolated synthetic connection succeeds. The investigation starts with the admitted policyTypes rather than the file name, because omission can select a different isolation direction than the author intended.

## The trust-boundary mechanism

Kubernetes documents direction-specific isolation. When policyTypes is omitted, Ingress is inferred and Egress is inferred when egress rules exist. A deny-egress policy therefore needs explicit Egress rather than relying on the absence of permitted rules. A Pod can remain non-isolated for egress even while an ingress policy selects it. These are distinct states, not contradictory observations of one universal deny flag.

## Define the control contract

Define the intended outbound traffic set and inspect the API-server representation after defaulting. Preserve every policy selecting the same Pod in that direction. Allowed traffic is the union of applicable permits; adding an explicit deny-style isolation object does not subtract an allowance from another object. Confirm that the networking implementation supports enforcement, and keep application authentication outside this network-direction contract.

## A step-by-step verification

First create disposable synthetic endpoints and a worker with the intended labels. Observe baseline connectivity. Next apply the generated policy in an authorized fixture and inspect its effective policyTypes. Compare with a variant explicitly selecting Egress, using fresh connections and the same endpoint. Finally include an intended allowed dependency under a separate narrow policy, confirming that the review distinguishes isolation from complete service breakage.

## Evidence required for acceptance

Acceptance requires the rendered source, admitted policy, Pod labels, full applicable policy set and connection outcomes. Preserve whether the test waited for policy handling rather than treating object creation as instantaneous enforcement. Include a control endpoint known to be healthy so failure is not attributed to policy merely because nothing answered. Report each direction independently; a successful ingress denial cannot certify the egress requirement.

## Failure cases and limits

This question concerns defaulted isolation direction, not namespace-selector grouping or a universal domain allowlist. Network implementation, address translation and protocols outside the documented policy scope can require additional qualification. The release should state the observed boundary for the deployed plugin. A descriptive object name or a successful manifest validation remains evidence about an artifact, not proof that outbound model-worker traffic is restricted.

## Primary references and related reading

Explicit direction and the admitted policy set determine egress isolation; an empty-looking manifest is insufficient. [Kubernetes NetworkPolicy isolation and address translation](https://kubernetes.io/docs/concepts/services-networking/network-policies/); [Kubernetes NetworkPolicy API defaults](https://kubernetes.io/docs/reference/kubernetes-api/networking/network-policy-v1/).

The proposed investigation of networkpolicy explicit egress isolation direction is a proposed control review; no live security test was executed. Related reading: [Pod stays unready after deny-all: init container network dependencies](/journal/kubernetes-egress-networkpolicy-bootstrap/); [Distinguish combined NetworkPolicy peer selectors from separate peers](/journal/guide-ks-networkpolicy-peer-and-or/).
