A Kubernetes NetworkPolicy restricts traffic within a cluster. It can limit traffic between Pods and Services and control ingress and egress traffic to Pods. Use it to define workload-level boundaries alongside, not in place of, service discovery and other network controls. section 10.4.2 section 10.4.3
Choose the surrounding controls according to the traffic path:
- For service-to-service traffic, use NetworkPolicy to limit which Pods and Services can communicate. A service mesh can separately provide mTLS and service-level security policies. section 10.4.2
- For traffic leaving the cluster, NetworkPolicies can control Pod egress using label selectors. Firewall rules can further limit destinations reachable from node IP subnets, through which Pod egress exits. section 10.4.3
- For a migrated multi-VM application, place codependent Pods in a namespace and restrict access between frontend and backend Pods with NetworkPolicy. section 15.5
Enforcement depends on the cluster data plane. GKE Dataplane v1 uses Calico and Linux iptables for NetworkPolicy enforcement; Dataplane v2 uses the Cilium agent and eBPF. Account for that implementation difference when comparing cluster networking options. section 10.2.1
The network-feature comparison identifies the enforcement component and mechanism used by each GKE data plane. section 10.2.1
NetworkPolicy is one Kubernetes security object, not a complete cluster-security procedure. The treatment identifies where to use it but does not supply a NetworkPolicy manifest or a step-by-step policy rollout. section 13.3.1 section 10.4.3

