What is external IP of a pod in k8s cluster?

1/15/2019

When a pod connects (say, makes an HTTP call) to a service outside of the cluster, what IP is it using? It cannot use its own private IP since this is unique only within the cluster. Does it use the Node's IP?

Can someone perhaps point me to a good resource which explains exactly what happens in such a situation?

Many thanks!

-- Greg Balajewicz
kubernetes
kubernetes-networkpolicy

1 Answer

1/15/2019

Don't know why this got downvoted. When you do an HTTP call through the network your packets are going through TCP (which most of the times goes over IP)

Basically, for TCP it's generally the IP address of your node if the HTTP call is going to an endpoint within the same subnet of your node or if you are using something like AWS VPCs, it's your private VPC IP address.

If your packet is traversing the public cloud from a private VPC then it would be the external facing IP address of your cloud. It all depends on where your TCP connection is terminated/forwarded.

If you are examining the IP packet it will be different and most likely will have src/dst that are within your own subnet only.

With Kubernetes you will never see the pod IP address if you are going outside of the PodCidr.

Hope it helps.

-- Rico
Source: StackOverflow