SECURITY ENGINEERING, IN PRACTICE.ANALYSIS / TECHNICAL NOTES / FIELD NOTES
Packet Notes.

Clear thinking on software,
infrastructure and security.

Field note

Egress policy begins with an inventory

The hardest part of restricting outbound traffic is knowing which dependencies belong there.

Find the operational dependency

A service’s outbound connections may include databases, identity providers, package registries, telemetry and name resolution. A useful egress policy begins with those dependencies and their owners. Traffic that appears during an ordinary request may be only a small part of the workload’s full lifecycle.

Kubernetes NetworkPolicy expresses allowed connections for selected pods when supported by the network implementation. The documentation also describes the additive behavior of policies. Review the effective policy rather than reading one object in isolation.

Make exceptions reviewable

For each dependency, we suggest recording purpose, destination description, protocol, owner and the behavior when the dependency is unavailable. Include startup, credential renewal and recovery jobs. A dependency that only appears during an outage still belongs in the inventory.

Start with a small service and compare the intended policy with observed normal operations. Give unexpected connections an explanation before turning them into permanent exceptions.

Check the boundary you actually have

A network policy is not an application authorization policy. A permitted connection can still carry an inappropriate request. Pair network restrictions with service identity and resource-level authorization, and document the specific network implementation on which the enforcement depends.

Combine rules before interpreting them

Kubernetes NetworkPolicies are additive: allowed traffic is the union of applicable rules. When both ends are isolated, the source egress rules and destination ingress rules must permit the connection. A later narrow policy does not subtract a broad allowance.

For a staging example, inventory every policy selecting a worker Pod before expecting a new database-only rule to restrict it. Check DNS separately from the database connection. Keep a permitted connection and a deliberately unpermitted connection in the evidence record, along with the network plugin and policy configuration used for the check.

Source & further reading

Kubernetes · Network Policies ↗