Pods and their IPs
A Pod is the smallest thing Kubernetes runs: one or more containers that share one network address. Each Pod gets its own IP. Pods on node 1 get 10.244.1.x and Pods on node 2 get 10.244.2.x. Containers inside one Pod talk over localhost.
Any Pod can reach any other Pod at its IP, even on another node, with no NAT (address rewriting) on the way. Kubernetes requires this; a network plugin (CNI) builds it. Here web sends straight to api Pod 2 at 10.244.2.5.
Pods are disposable. When api Pod 2 is deleted, its node fails, or it is updated, a fresh Pod replaces it and gets a new IP: 10.244.2.5 becomes 10.244.2.6. Code that saved the old address now fails. Clients need a name that stays put.
A stable Service
A Service is a fixed front door for a group of Pods. This one, named api, picks every Pod labelled app: api. It gets a virtual IP, its ClusterIP (here 10.96.0.20), which stays the same for as long as the Service exists.
Kubernetes keeps a live list of the ready Pods behind each Service, called an EndpointSlice. When a Pod is replaced, or fails its readiness check, the list updates by itself. Nobody edits it by hand.
Following one request
Line 2 asks for http://api/items. Inside a Pod, the short name api expands to api.shop.svc.cluster.local. The cluster's DNS server, CoreDNS, answers with the Service's ClusterIP, 10.96.0.20.
The web Pod sends its request to 10.96.0.20, port 80. No machine owns that address: it is virtual, and nothing listens on it. Before the packet leaves node 1, the node's own packet rules catch it.
kube-proxy, a helper on every node, turned the EndpointSlice into these rules. They pick one ready Pod at random and rewrite the destination: 10.96.0.20:80 becomes 10.244.2.6:8080. This rewrite is called DNAT.
Now it is a plain Pod-to-Pod packet, so it crosses to node 2 and api Pod 2 answers. On the way back the rules undo the rewrite, so web sees a reply from 10.96.0.20. Line 3 prints 200.
Each new connection is a fresh random pick, so the load spreads over both Pods. Start a third Pod labelled app: api and it joins the EndpointSlice: the Service grows with no change to the code in web.
What happens
;; step 1/10 · pod-ip cluster Pod network 10.244.0.0/16 node-1 10.244.1.0/24 node-2 10.244.2.0/24 web Pod 10.244.1.3 api Pod 1 10.244.1.4 api Pod 2 10.244.2.5 containers in one Pod → localhost
The Kubernetes network model gives every Pod its own cluster-wide IP and lets Pods reach each other without NAT. Kubernetes does not build that network itself: a CNI network plugin such as Flannel, Calico or Cilium does. The address ranges are common defaults, not rules: 10.244.0.0/16 is Flannel's default Pod network (one /24 per node) and 10.96.0.0/12 is kubeadm's default Service range. Your cluster may use others.