Network
Pod to Pod, across nodes
The VXLAN overlay
A packet between nodes is wrapped inside another packet, sent node to node, and unwrapped on the other side. Pod IPs mean nothing outside a node, so flannel hides the whole Pod network inside ordinary UDP traffic between the nodes themselves.
- Sender
- web-…-kq9tw · 10.244.1.12 · node-1
- Receiver
- web-…-x2kqp · 10.244.2.17 · node-2
- Tunnel
- VXLAN · VNI 1 · UDP 8472 · +50 B
- Underlay
- one UDP packet 10.0.1.11 → 10.0.1.12
Read the whole lesson as text
1. Not on this subnet
web-…-kq9tw's own subnet is 10.244.1.0/24, and 10.244.2.17 isn't in it, so the Pod sends the SYN to its default gateway: 10.244.1.1, the cni0 bridge. The node's own route table takes over from there: 10.244.2.0/24 lives via 10.244.2.0 on flannel.1, the overlay device. The next-hop MAC isn't found with a broadcast - flannel pre-installed a permanent neighbor entry mapping 10.244.2.0 to node-2's tunnel endpoint.
- The destination isn't on this Pod's subnet, so the SYN goes to its default gateway: the bridge.
- Inside the node, a different route table points at flannel.1, the overlay device.
- No ARP goes out: flannel already installed the answer - 10.244.2.0 is node-2's tunnel endpoint.
2. Wrap in VXLAN
flannel.1 builds a brand-new Ethernet frame around the IP packet, addressed not to the Pod but to node-2's flannel.1, MAC 32:47:a1:5c:9e:df. Then the whole thing becomes payload: an outer IPv4 header addressed 10.0.1.11 → 10.0.1.12, a UDP header aimed at port 8472, and an 8-byte VXLAN header saying VNI 1. The mapping "10.244.2.0 belongs to node-2" comes from the routes and fdb entries flannel programmed at setup.
- The IP packet gets a fresh Ethernet header, addressed to node-2's flannel.1 - not to the Pod.
- Then four headers go around the whole thing: Ethernet, IP, UDP 8472, and an 8-byte VXLAN tag.
- A full-size Pod packet would still fit: the interfaces were sized for this at CNI time.
- The wrapped packet is just a UDP payload now, handed to the node's real network card.
3. Across the underlay
To the cluster network, this is one unremarkable 124-byte UDP packet between two machines. Routers between the nodes only ever read the outer header, so they never route on a Pod IP. The wrapper costs 50 bytes per packet, which is why every Pod interface got MTU 1450 at CNI time: 1500 minus 50, so a full-size inner packet never needs fragmenting.
- To the network between nodes, this is one unremarkable UDP packet between two machines.
4. Unwrap on node-2
node-2's eth0 receives a UDP packet for port 8472 and the kernel hands it straight to the flannel.1 device. It checks the VXLAN header: VNI 1, the network this device was created for. It pops the 50 wrapper bytes, and out comes an Ethernet frame addressed to the VTEP's own MAC - that's node-2's cue to keep it.
- node-2's kernel sees UDP port 8472 and hands the packet to the flannel.1 device.
- The VTEP peels off the 50-byte wrapper; the inner frame is addressed to it, so it keeps it.
5. The last hops
Now it's the same-node story again. 10.244.2.17 matches 10.244.2.0/24 dev cni0, the neighbor table gives the Pod's MAC, and the frame's destination is rewritten from 32:47:… to 6e:9c:b0:3f:a2:17. The bridge forwards out of port veth3b1c, whose other end is eth0 inside web-…-x2kqp.
- Now it's the same-node story: the destination is local, via the bridge.
- The bridge forwards out of the port that leads into the Pod.
6. Seen from inside
Inside the receiving Pod nothing reveals the trip. The SYN arrives on eth0 addressed to 10.244.2.17:8080, from 10.244.1.12:41244 - a plain neighbor address as far as this namespace knows. The app accepts and sends its SYN-ACK back to eth0. From here it's the same machinery in reverse.
- The SYN arrives on eth0 looking perfectly ordinary.
- The app accepts; the client looks like any neighbor on 10.244.0.0/16.
- The SYN-ACK goes back to eth0, and from there through the same machinery in reverse.
7. One flat network
The SYN-ACK is wrapped again - outer UDP 10.0.1.12 → 10.0.1.11:8472, VNI 1 - and rides the underlay back. node-1 unwraps it into kq9tw's veth, and the handshake completes about 0.85 ms after connect(). Both Pods exchanged packets the whole time; neither has any way to tell they're 0.3 ms of underlay apart.
- The reply rides the tunnel back the same way: one UDP packet between the nodes.
- node-1 unwraps it into kq9tw's veth and the handshake completes, 0.85 ms after it began.
Summary
The underlay carried exactly one UDP packet between two node IPs, and inside it rode a perfectly ordinary Pod-to-Pod packet. Neither Pod noticed: the sender dialed 10.244.2.17 and got an answer from it, on what looks to both like one flat 10.244.0.0/16 network. The 50-byte tax is paid on every packet, which is why Pod MTUs are 1450.
Next lesson: Pod calls a Service