Investigation
Start with the boundary, not with ad-hoc firewall guesses.
Safe investigation sequence:
- Map the flow: List the source pod, target service, namespace, and port involved.
- Prove exposure: Use
curlorncfrom within the pod to prove what traffic is currently open. - Define requirements: Define the minimum required paths: DNS, Ingress, and specific Egress targets.
- Test one by one: Test each allow rule individually against a default-deny baseline.
Containment
Containment narrows traffic fast by shifting to an opt-in model.
Containment steps:
- Apply Default Deny: Apply a namespace-wide
default-deny-allpolicy. - Enable DNS: Add back the DNS egress path (port 53) so pods can resolve names.
- Enable Ingress: Open the Ingress path from your controller (e.g., Traefik).
- Allow Specific Egress: Add rules for only the exact external services the workload truly needs.
The goal is not “network works somehow”; the goal is “network is explainable.”
Pause and Predict: What automated guardrail would have prevented this incident entirely?