In a service call, when a service gets the backend pod IP from iptable (DNAT), how does it know which node contains the pod when the request first goes to a node where the pod is not present?
1 Like
The request for a service call is made to the ClusterIP, the kube-proxy on the node intercepts the request. The kube-proxy manages rules in iptables or IPVS. These rules perform destination NAT (DNAT) to translate the Service IP into one of the backend Pod IPs.
I wrote about it recently if you want to take a look here
3 Likes
Yes, the Service IP translates to backend pod ip using Iptables. But suppose the node where the iptables rule is executed doesn’t contain the pod. The pod is available in another node. So there should be an extra step, where it decides which nodes contain the pod and forward the request there. So, question is, how this destination node is seleted? Is there any pod to node mapping? if yes, where the details can be found?