Overlay Networks Encapsulate Pod Traffic Inside Node-to-Node Packets
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)
- Pod A (
10.244.1.3) sends a packet to pod B (10.244.2.5) on another node. - 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). - The switch delivers it like any other node-to-node traffic.
- Flannel on node 2 strips the outer headers and hands the original packet to pod B.
References
- Networking MOC - hub for networking notes.
- A Pod Is the Unit Kubernetes Schedules, and Each Pod Gets an IP from the Pod CIDR - where the overlay addresses come from.
- Flannel documentation: Backends - VXLAN and its port.
- RFC 7348: VXLAN - the encapsulation format.
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.