KubeDojo

Network Policies for Traffic Control

AK
by Alexis Kinsella··14 min read
Network Policies for Traffic Control

By default, every pod in a Kubernetes cluster can talk to every other pod. No firewall rules, no segmentation, no access controls. A compromised container in a development namespace can reach your production database. A rogue workload can scan the entire cluster network. Kubernetes ships with a flat network model, and unless you do something about it, that flat network is wide open.

Network Policies are how you fix that. They are the only built-in Kubernetes API for controlling pod-to-pod and pod-to-external traffic at L3/L4. The core pattern is straightforward: default deny, then whitelist. The implementation details, especially selector semantics and CNI plugin requirements, are where things get interesting.

Sign in to access this lesson

Create a free account or sign in to enroll in the KCSA — Kubernetes and Cloud Native Security Associate course and access all 39 lessons.

KCSA — Kubernetes and Cloud Native Security Associate

39 lessons

Browse the full course curriculum →