Cloud Native 14 min read

Understanding Kubernetes Underlay and Overlay Network Models: A Deep Dive

This article provides a comprehensive overview of Kubernetes networking, explaining the concepts of underlay and overlay network models, their implementations with Flannel, Calico, IPVLAN, MACVLAN, Multus, DANM, and common tunneling protocols such as VxLAN, IPIP, and GRE, while highlighting practical configuration notes and architectural differences.

Open Source Linux
Open Source Linux
Open Source Linux
Understanding Kubernetes Underlay and Overlay Network Models: A Deep Dive

Overview

This article explores the network models in Kubernetes and analyzes various models.

Underlay Network Model

What is an Underlay Network

The underlay network refers to the physical network infrastructure such as switches, routers, and DWDM that link devices into a physical topology responsible for packet transmission.

Underlay network topology
Underlay network topology

The underlay network can be layer‑2 (e.g., Ethernet) or layer‑3 (e.g., Internet). Layer‑2 technologies include VLAN, while layer‑3 uses protocols such as OSPF and BGP.

Underlay network in Kubernetes

In Kubernetes, a typical underlay example is using the host as a router, with Pods learning routes to achieve cross‑node communication.

Underlay network topology in Kubernetes
Underlay network topology in Kubernetes

Typical implementations are Flannel host‑gw mode and Calico BGP mode.

Flannel host‑gw

In flannel host‑gw mode each node must be on the same layer‑2 network and acts as a router, forming an underlay network.

Layer2 Ethernet topology
Layer2 Ethernet topology
Notes: Because routing is used, the cluster CIDR must be at least /16 to ensure node and pod networks are separate.

Calico BGP

BGP (Border Gateway Protocol) is a decentralized routing protocol that maintains IP routing tables or prefix tables to provide connectivity between autonomous systems.

Calico network architecture
Calico network architecture

Unlike flannel, Calico provides a BGP solution. Flannel uses the flanneld process to maintain routes, while Calico consists of multiple daemons; the Brid process acts as a BGP client and router reflector, and the BGP client obtains routes from Felix and distributes them to BGP peers. The router reflector reduces the number of internal BGP connections, and Bird works as the BGP client.

IPVLAN & MACVLAN

IPVLAN and MACVLAN are NIC virtualization technologies. IPVLAN allows multiple IP addresses on a single physical NIC with a shared MAC, while MACVLAN allows multiple MAC addresses on a single NIC, each virtual interface may lack an IP.

These are overlay network technologies that flatten the pod network to the node level, providing higher performance and lower latency.

Virtual networking modes: bridging, multiplexing and SR-IOV
Virtual networking modes: bridging, multiplexing and SR-IOV

Virtual bridge: creates a veth pair, one end in the container, the other in the host root namespace, allowing packets to pass through the bridge.

Multiplexing: uses an intermediate device exposing multiple virtual NICs, distinguished by MAC/IP.

Hardware offload (SR‑IOV): assigns a virtual NIC to each pod, using VF interfaces that share a physical PCIe channel.

In Kubernetes, IPVLAN is used by CNI plugins such as multus and danm.

multus

Multus is an Intel open‑source CNI that combines traditional CNI with multus and provides an SR‑IOV plugin, enabling pods to use IPVLAN/MACVLAN.

When a new pod is created, the SR‑IOV plugin moves the VF into the pod’s network namespace, sets the interface name from the CNI config, and brings the VF up.

Example pod with three interfaces: eth0 (flannel default), VF on host port ens2f0 (south0), and VF on host port ens2f1 (north0) using vfio-pci driver.

Multus networking architecture overlay and SR‑IOV
Multus networking architecture overlay and SR‑IOV

danm

DANM is Nokia’s open‑source CNI project that brings carrier‑grade networking to Kubernetes, supporting SR‑IOV, DPDK, and IPVLAN.

Overlay Network Model

What is an Overlay

An overlay network uses virtualization techniques to build a logical network on top of an underlay network without changing the physical infrastructure. It typically employs tunnel protocols to encapsulate packets.

Overlay network topology
Overlay network topology

Common tunnel technologies

Generic Routing Encapsulation (GRE) encapsulates IPv4/IPv6 packets at L3.

VxLAN (Virtual Extensible LAN) encapsulates L2 Ethernet frames into UDP packets, using port 4789 by default.

Typical overlay implementations in Kubernetes include flannel and calico using VxLAN or IPIP modes.

IPIP

IP in IP is a tunnel protocol implemented via the Linux kernel module ipip.ko; it can be loaded with modprobe ipip and verified with lsmod | grep ipip.

IPIP network workflow
IPIP network workflow

In Kubernetes, IPIP works similarly to VxLAN, encapsulating packets within IP packets.

IPIP in Kubernetes
IPIP in Kubernetes
IPIP packet with Wireshark unpack
IPIP packet with Wireshark unpack
Notes: Public clouds may block IPIP traffic, e.g., Azure.

VxLAN

Both flannel and calico implement VxLAN using Linux kernel support introduced in kernel 3.7.0; newer kernels (≥3.9.0) are recommended.

VxLAN network topology
VxLAN network topology

In Kubernetes, flannel maintains a VxLAN device (flannel.1) per node, assigning a VNID and routing MAC addresses to forward traffic across nodes.

To view the forwarding database:

$ bridge fdb
26:5e:87:90:91:fc dev flannel.1 dst 10.0.0.3 self permanent
VxLAN in Kubernetes
VxLAN in Kubernetes
VxLAN packet with Wireshark unpack
VxLAN packet with Wireshark unpack
Notes: VxLAN uses port 4789; flannel defaults to UDP port 8472, so captures may show UDP.

Tunnels are abstract concepts that encapsulate packets for transport over the physical network and then decapsulate them.

weave VxLAN

Weave also uses VxLAN, referred to as fastdp (fast data path), built on the openvswitch datapath module and encrypts traffic.

Weave fastdp network topology
Weave fastdp network topology
Notes: fastdp works on Linux kernel ≥3.12; older kernels use user‑space sleeve mode.

Reference

https://github.com/flannel-io/flannel/blob/master/Documentation/backends.md#host-gw https://projectcalico.docs.tigera.io/networking/bgp https://www.weave.works/docs/net/latest/concepts/router-encapsulation/ https://github.com/k8snetworkplumbingwg/sriov-network-device-plugin https://github.com/nokia/danm

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

KubernetesOverlayCNINetwork ModelCalicoFlannelUnderlay
Open Source Linux
Written by

Open Source Linux

Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.