liveBook · Manning

Kubernetes network model

As explained in Kubernetes in Action, Second Edition

The Kubernetes network model is the networking design in which pods can reach one another and nodes can reach pods across the cluster.

The Kubernetes network model makes every pod reachable from every other pod and lets every node reach every pod, regardless of the pod's node. A container can accept connections through its pod IP and bound port even when the port is omitted or incorrect in the manifest; declaring ports documents exposure and enables named service ports. section 5.3.1

Test connectivity through progressively longer paths:

  • From the hosting worker node, curl the pod IP and port; local communication provides the shortest diagnostic route. section 5.3.1
  • From a temporary client pod, curl the target pod to test whether normal pod-to-pod communication works. section 5.3.1
  • Use kubectl port-forward for local access through a proxy, rather than testing the direct cluster network path. section 5.3.1

Testing a pod from another pod

Run `kubectl run --image=curlimages/curl -it --restart=Never --rm client-pod curl 10.244.2.4:8080`. The temporary client receives the application's response and is then deleted. section 5.3.1

$ kubectl get pod kiada -o wide
NAME    READY   STATUS    RESTARTS   AGE   IP           NODE     ...
kiada   1/1     Running   0          35m   10.244.2.4   worker2  ...

Inspect a pod's IP and assigned node before testing direct connectivity. section 5.3.1

How Kubernetes in Action, Second Edition covers it

How deep it goes
Defines reachability and demonstrates node, pod, and port-forwarding paths, stopping short of network implementation details.
Examples
Demonstrates worker-node curl, a temporary curl client pod, pod inspection, and kubectl port forwarding.
What it assumes
Uses pod IPs, container ports, worker nodes, and curl as the working vocabulary for connectivity tests.
What you can do after
Diagnose pod connectivity by testing direct node, pod-to-pod, and port-forwarded routes.
How it connects
Connects pods, nodes, container ports, services, curl, and kubectl port forwarding.

This explainer was generated by Manning's knowledge graph from the text of Kubernetes in Action, Second Edition. The section links point to the parts of the book it draws on.