Overlay Networks Encapsulate Pod Traffic Inside Node-to-Node Packets

In progress Networking Kubernetes

An overlay network is a virtual network built on top of the physical one, the underlay. Machines on the overlay behave as if they shared one flat network, while the underlay only ever sees ordinary packets between physical hosts. That's how Kubernetes gives every pod a routable IP without reconfiguring switches or routers.

Two Layers

Underlay Overlay
What it is cables, switches, VLANs, MAC addresses, the home or data-centre subnet a logical network in software
Example range 192.168.1.0/24 10.244.0.0/16 (pod CIDR)
Who routes it physical switches and routers the overlay software on each node (Flannel, Calico, a mesh VPN)

Encapsulation Step by Step (Flannel with VXLAN)

  1. Pod A (10.244.1.3) sends a packet to pod B (10.244.2.5) on another node.
  2. Flannel on A's node wraps the whole packet in a UDP packet addressed from node 1 (192.168.1.10) to node 2 (192.168.1.20).
  3. The switch delivers it like any other node-to-node traffic.
  4. Flannel on node 2 strips the outer headers and hands the original packet to pod B.

References

Review cards

Flashcard Why does encapsulating pod traffic in node-to-node packets require adjusting the pod MTU?

Because the outer headers take about 50 bytes, reducing the effective MTU. If the pod MTU isn't lowered, large packets may get fragmented or dropped.

Flashcard What happens if a host firewall blocks UDP port 8472 between nodes using VXLAN?

Pod-to-pod traffic across nodes is cut off, but same-node traffic still works.