Is there a way to preserve the source port for outgoing traffic in Kubernetes?

5/20/2020

In most TCP client/server communications, the client uses a random general purpose port number for outgoing traffic. However, my client application, which is running inside a Kubernetes cluster, must use a specific port number for outgoing traffic; this is due to requirements by the server.

This normally works fine when the application is running externally, but when inside a Kubernetes cluster, the source port is modified somewhere along the way from the pod to the worker node (verified with tcpdump on worker node).

For context, I am using a LoadBalancer Service object. The cluster is running kube-proxy in Iptables mode.

-- anonemes11
client-server
kubernetes
networking
port
tcp

0 Answers