Flannel — How It Works¶
VXLAN overlay, subnet lease allocation, and backend mechanics.
VXLAN Overlay¶
sequenceDiagram
participant PodA as Pod A (Node 1, 10.244.0.2)
participant Flannel1 as flanneld (Node 1)
participant VTEP1 as VXLAN VTEP (flannel.1)
participant Network as Physical Network (UDP 8472)
participant VTEP2 as VXLAN VTEP (flannel.1)
participant PodB as Pod B (Node 2, 10.244.1.3)
PodA->>VTEP1: Packet to 10.244.1.3
VTEP1->>VTEP1: Encapsulate in VXLAN header
VTEP1->>Network: UDP 8472 → Node 2
Network->>VTEP2: Receive VXLAN packet
VTEP2->>VTEP2: Decapsulate
VTEP2->>PodB: Deliver original packet
Subnet Lease Model¶
Each node gets a /24 subnet from the cluster CIDR (e.g., 10.244.0.0/16). Flannel stores leases in etcd or the Kubernetes API (via kube-subnet-mgr).
| Node | Subnet Lease | VTEP IP |
|---|---|---|
| Node 1 | 10.244.0.0/24 | 10.244.0.0 |
| Node 2 | 10.244.1.0/24 | 10.244.1.0 |
| Node 3 | 10.244.2.0/24 | 10.244.2.0 |