I'm trying to implement a distributed load-testing application using Kubernetes; each pod is running a single container which sends SMB requests to a server on my local network.
After tracing the packets sent to/from the server I've found that all of the requests going out to the server originate from the cluster IP (as they should with the default behavior of Kuberentes).
Is there a way to configure this setup so that each pod gets it's own external IP rather than connecting through the cluster? Or is there another container orchestration service (i.e. Docker Swarm) that would better fit this use case?
Your network is probably in a range other then 10.0.0.0/8. Check out this rule:
-A POSTROUTING ! -d 10.0.0.0/8 -m comment --comment "kubenet: SNAT for outbound traffic from cluster" -m addrtype ! --dst-type LOCAL -j MASQUERADE
For a packet to any destination address, other than 10.0.0.0/8, masquerade the address with the node IP.
Unfortunately, all your pods inside the cluster are always behind the NAT, that's why you always see the cluster IP. However, you can try to use some workarounds to avoid this NAT. For example, you can try to use hostNetwork: true
for your deployment. Your pods will be started in your network not behind the NAT. Also, you can play around with some Network plugins.