What does `externalTrafficPolicy: Local` change on a LoadBalancer Service?
AdvancedConceptKubernetes, Containers, MTU & Performance Basics
Answer
With the default Cluster, a node may forward traffic to a pod on another node, adding a hop and SNAT, so the pod loses the client source IP. With Local, a node only serves traffic to its own pods, preserving client IP and avoiding the extra hop, and the load balancer's health check removes nodes without local pods.
Trade-off: uneven distribution if pods are not spread evenly across nodes, so combine it with topology spread constraints.
More on Kubernetes, Containers, MTU & Performance Basics
What are the basic Kubernetes networking rules?BeginnerWhat are the Service types in Kubernetes?BeginnerWhat is the difference between a Service and an Ingress?BeginnerHow does kube-proxy implement Services?AdvancedHow does DNS work for Services and pods in Kubernetes?IntermediateWhat is a CNI plugin and how do the main ones differ?Intermediate