NetworkPolicy CNI Requirements
What you'll learn: You'll understand why NetworkPolicies need specific networking plugins to work and which ones support them.
The Networking Foundation Problem
NetworkPolicies are just YAML manifests—they're instructions that say "block this traffic" or "allow that connection." But here's the catch: vanilla Kubernetes doesn't enforce them by itself. You need a Container Network Interface (CNI) plugin that knows how to read and implement these policies at the network layer.
Think of it like writing traffic laws: the law itself doesn't stop cars. You need police officers (the CNI plugin) who understand and enforce those rules.
Compatible CNI Plugins
Not all CNI plugins support NetworkPolicies. The most common ones that do include:
- Calico – Popular, feature-rich, excellent policy support
- Cilium – Modern, eBPF-based, high performance
- Weave Net – Simple to set up, good for smaller clusters
Simpler plugins like Flannel (in basic mode) do not support NetworkPolicies. If you create a NetworkPolicy in a cluster running Flannel alone, nothing happens—the policy is ignored silently.
Why This Matters
Before deploying NetworkPolicies, verify your cluster's CNI:
kubectl get nodes -o wide
kubectl get pods -n kube-system | grep cni
If you're using a managed Kubernetes service (EKS, GKE, AKS), check their documentation for NetworkPolicy support. Some require enabling specific add-ons.
Key Takeaway: NetworkPolicies require a compatible CNI plugin like Calico, Cilium, or Weave to actually enforce network rules—without one, your policies are ignored.