Expected behavior If my service object of type LoadBalancer has externalTrafficPolicy set to Local, the forwarded packets should preserve the original client source IP address.
Actual behavior TCP/UDP packets arriving at the pod have their source IP set to the LoadBalancer IP.
Context This is important for some protocols like STUN, that allows clients to discover their public IP address and the type of NAT they are behind.
Steps to reproduce
- Deploy a single replica deployment, running netcat on port 22333 (
nc -lvk 22333)
- Service object, with
type: LoadBalancer and externalTrafficPolicy: Local forwarding traffice to that deployment, port 22333
- Wait for IP to be assigned.
- On client, open netcat connection to server (
nc -v $IP 22333)
- On the server, it should now display the IP for the respective loadbalancer (instead of the IP of the client).