Why requests outgoing from the nodes IPs instead of the Load Balancer?

1/25/2022

I have a K8S cluster with 3 nodes and 1 Load Balancer. I need to white label my IP in third party APIs. But instead of providing the Load Balancer's IP, I see that requests are coming from the IP of the actual node. If I scale I need to keep track of this manually? How does it working?

-- Raz Buchnik
kubernetes
load-balancing

1 Answer

1/25/2022

You're referring to NATting your cluster's outbound traffic.

Traffic outbound of the cluster will always leave from the nodes, and not the load balancers. Load Balancers are for inbound traffic.

If you want to white label (I assume you mean "whitelist" or "allowlist"), you need to use something like Cloud NAT https://cloud.google.com/nat/docs/overview or Cloud Router https://cloud.google.com/network-connectivity/docs/router/concepts/overview to force your traffic through a known external IP which you can then allow at the third party end.

Even if you scale up to multiple nodes, if you have configured Cloud NAT/Cloud Router, you will still come out of the same external IP.

-- Blender Fox
Source: StackOverflow