externalTrafficPolicy=local on Kubernetes
So how exactly does this work, and why do we need it?
Routing traffic to a Kubernetes cluster
ExternalTrafficPolicy=local
Preserving Source IP with Kubernetes ingress
externalTrafficPolicy=local
service
service
So how exactly does this work, and why do we need it?
Pods and Nodes: Recap
In Kubernetes, containers are deployed in individual pods, which are then deployed on one or more nodes. A node is a physical or virtual machine, and represents the actual, concrete compute entity of a Kubernetes cluster. Kubernetes schedules pods to run on nodes based on a variety of criteria such as resource availability. Multiple pods are typically run on a single node.
Routing traffic to a Kubernetes cluster
Traffic entering a Kubernetes cluster arrives at a node. The node then routes traffic to the target pod via
kube-proxy
ExternalTrafficPolicy=local
This leads us to
ExternalTrafficPolicy
By setting
ExternalTrafficPolicy=local
ExternalTrafficPolicy
Preserving Source IP with Kubernetes ingress
How else can you preserve source IP with Kubernetes? If your external load balancer is a Layer 7 load balancer, the
X-Forwarded-For