Appearance

Pod networks and service routing

Trace a direct Pod connection across nodes and a Service connection through an eligible backend.

What you will understand

  • Describe what CNI plugins configure when a Pod joins the network.
  • Follow Pod-to-Pod routing and identify where an implementation may use routing or encapsulation.
  • Explain how kube-proxy or an alternative implementation uses Service and EndpointSlice information.

Builds on: Topology and resource governance

How Pods communicate across nodes

A frontend Pod on one node opens a connection to an API Pod on another. First the Pods need working interfaces and addresses. Then the network needs a route for the packets. A Container Network Interface (CNI) plugin follows an interface used by runtimes to configure container networking. In a Kubernetes cluster, the network implementation commonly uses plugins to give Pods addresses and connect them to the node’s network, and may run agents to arrange routes and policy across nodes.

From the frontend’s point of view, the direct connection is addressed to the API Pod’s IP. The packet leaves the frontend’s network namespace and travels through the network to the backend. One implementation might route the Pod IP ranges directly. Another might wrap the packet for transport between nodes and unwrap it on arrival. The Pod-path scene focuses on the visible hops, which you can use to ask where a packet could be lost.

Follow traffic between Pods on different nodes

Each Pod has an address of its own. The node network carries traffic between those addresses.

  1. Container runtimeSet up Pod networking
    CNI pluginThe Pod receives a network interface and an IP address.
  2. Client PodOpen a connection to the backend Pod IP
    Source nodeThe packet enters the node network with the backend address.
  3. Source nodeRoute across the worker boundary
    Destination nodeThe cluster networking implementation delivers the packet to the worker that hosts the backend.
  4. Destination nodeDeliver to the application port
    Backend PodThe application can handle the connection.
Follow the sequence

Each Pod has an address of its own. The node network carries traffic between those addresses.

CNI providers implement this contract differently; arrows do not prescribe an overlay or particular kernel hook.

Explore another case

How a Service forwards a connection

A Service gives the frontend a stable IP and port as the backend Pods come and go. In the manifest, clients connect to port 80 and the service data plane forwards to port 8080 on a selected backend. Pods must already exist with app: api, and their app must listen on 8080. EndpointSlices identify the current addresses and include readiness conditions. A backend can still appear in a slice when it is unready.

apiVersion: v1
kind: Service
metadata:
  name: api
spec:
  selector:
    app: api
  ports:
    - name: http
      port: 80           # Client's Service port.
      targetPort: 8080   # Port the selected backend actually listens on.

kube-proxy watches Services and EndpointSlices and programs forwarding rules on nodes. The packet path typically goes through the rules it installs. Some CNI implementations replace kube-proxy and use eBPF, which runs programs at kernel hooks, to handle Service forwarding. The details differ by cluster, but in both cases a client that contacts the Service address needs a route to a usable endpoint. Follow the paths in the second scene.

Track the virtual IP and the selected Pod IP

EndpointSlices inform the forwarding implementation. The client sends traffic to the virtual Service address and the node forwards it to a usable backend.

  1. EndpointSlice controllerPublish matching backend addresses
    EndpointSliceThe slice records endpoint addresses, ports, and conditions.
  2. Node networking implementationWatch the Service and backend state
    Forwarding rulesThe virtual frontend has ready backends to use.
  3. Client PodConnect to the Service port
    Node forwardingThe destination starts as the Service IP and port.
  4. Node forwardingSend traffic to a ready endpoint
    Backend PodThe selected Pod receives the connection on its target port.
Follow the sequence

EndpointSlices inform the forwarding implementation. The client sends traffic to the virtual Service address and the node forwards it to a usable backend.

Ordinary selector Service without publishNotReadyAddresses; all-unready variant is non-terminating; existing connections are not modeled.

Inspect YAML or commands

Choose a ready backend

kubectl get endpointslices -l kubernetes.io/service-name=api -o yaml
Explore another case

Compare direct and Service requests

From your test client, check DNS first. Then compare the selected Pod and EndpointSlice addresses, ports, and conditions. Try the request via the Service and, where policy allows, directly to a known ready Pod’s IP and listening port. A working Pod IP with a failing Service narrows the investigation toward selector, endpoint conditions, or Service forwarding. The example names assume you created api and client. Use the exercise’s actual names and port in the networking lab.

kubectl get service api -o wide
kubectl get pods -l app=api -o wide
kubectl get endpointslices -l kubernetes.io/service-name=api -o yaml
# These example names require matching api and client resources.
# The downloadable baseline instead uses m08 and m08-client, port 80.
kubectl exec client -- nslookup api
kubectl exec client -- wget -qO- http://api:80

Test across nodes in the target cluster

Two Pods on one node can communicate even if routing between nodes is broken. Repeat the test from another node when investigating cross-node failures. For a connection that reaches the Service with no ready backend, implementations can differ in whether a caller sees a refusal or timeout. Inspect the objects and run a controlled request before inferring the cause from one error string.

Check your understanding

A Service resolves in DNS and you can reach its ready Pod IP directly. The Service request still fails. Where would you look next?

Check the Service port and target port, then the EndpointSlice ready condition and which backend address it publishes. If those are correct, investigate the cluster’s Service forwarding implementation on the caller’s node.

Primary documentation

Go to the source

Reviewed 2026-10-27 · Kubernetes 1.37 · Related local exercise

Search the book

Search loads when you open it.

Keyboard shortcuts

Ctrl + K / ⌘ + K
Search the book
?
Open this guide
Tab / Shift + Tab
Move between controls
Enter / Space
Activate a focused button or disclosure
← / →
Focused visual timeline · previous or next step
Home / End
Focused visual timeline · first or last point
Esc
Close the open dialog or menu