How to NAT source IP address of POD connecting to server on external Public IP address?

5/13/2019

I have an application running in a POD on kubernetes. This application connects to server external Public IP address and expects the clients to have specific public IP address. The server checks the source IP address for security.

Now that my application is running inside k8s cluster it will have some local IP address.

How to fix this ... is there a way to do NAT on source IP address based in the destination server address ? If so how to do this ?

-- Chandu
kubernetes
nat
networking

1 Answer

5/13/2019

Kubernetes uses worker nodes Internet connection. You can setup NAT for your nodes and the Kubernetes will use NAT's public IP. You can further attach multiple public IPs to NAT node and write iptables or iproute rules which can make NAT or routing decisions based on destination IP address.

-- Vasily Angapov
Source: StackOverflow