<p>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.</p>

<p>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).</p>

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

<p>So I found that I can achieve this by setting the <code>hostNetwork</code> field to <em>true</em> in the pod's spec.</p>
<p>Not an ideal solution but gets the job done.</p>
