CILIUM · CILIUM: UP AND RUNNING · CHAPTER 5

The Cilium datapath

Follow the packet: within the node, between nodes, over native routes or inside a tunnel.

6 min readBook: Cilium: Up and RunningLevel: intermediate

From point A to point B

Point A: your pods have IPs and talk to each other, but you don't know which path a packet takes. Point B: by the end of this chapter you'll be able to follow a packet within a node and between nodes, tell native routing apart from tunnels, and choose VXLAN, Geneve or native routes based on your network.

The Linux networking basics

Cilium's datapath is the set of pieces that process, route and deliver each packet. It relies on two kernel primitives:

  • Network namespace: an isolated copy of the network stack, with its own interfaces, routes and rules. Each pod has its own; the host has its own too.
  • veth pair: two virtual interfaces joined like a cable. Whatever goes in one end comes out the other. Inside the pod you see eth0; on the host, its peer is called lxc….
Connecting to what you know. These are the same namespaces you saw in the Docker topic. Cilium doesn't invent isolation: it connects it and decides what goes through each cable.

Two pods on the same node

Cilium attaches eBPF programs to the host end of each veth pair. That way it decides what to do with a packet the moment it leaves the pod, without going through bridges or iptables chains.

Two pods on the same node Each pod lives in its own network namespace with an eth0 interface. A veth pair connects eth0 to an lxc interface in the host namespace. An eBPF program on the lxc interface handles every packet that leaves the pod and delivers it straight to the lxc of pod B without encapsulation. cilium_host is the pods' gateway; cilium_vxlan is used only for traffic to other nodes. NODE · KIND-WORKER pod-aown network namespaceeth0 · 10.244.1.203 pod-bown network namespaceeth0 · 10.244.1.69 veth pairs cross into the host namespace lxc… (pod-a) lxc… (pod-b) eBPFcil_from_container CILIUM DEVICES IN THE HOST NAMESPACE cilium_host · gateway cilium_net cilium_vxlan eth0 · node only for other nodes

The packet leaves the pod, the host's eBPF processes it and delivers it to the other pod without a tunnel. Diagram: The House of Routing.

Check it. Create two pods on kind-worker:

for p in alpha beta; do
  kubectl run $p --image=nicolaka/netshoot \
    --overrides='{"spec":{"nodeName":"kind-worker"}}' -- sleep infinity
done
kubectl get pods -o wide

# Inside the pod: eth0@ifN shows the index of its peer on the host
kubectl exec alpha -- ip -br addr show eth0
kubectl exec alpha -- ip route

alpha's default gateway is an IP that lives on cilium_host, in the host namespace. Now look at the node side:

# Each pod's lxc… peers, plus Cilium's devices
docker exec kind-worker ip -br link | grep -E "lxc|cilium"
DeviceWhat it's for
lxc…Host end of each pod's veth pair
cilium_hostHolds the IP pods use as their gateway
cilium_netPeer of cilium_host; together they form another veth pair
cilium_vxlan / cilium_geneveTunnel to other nodes; not used within the same node

Which eBPF programs are attached, and where? bpftool ships inside the agent container:

AGENT=$(kubectl -n kube-system get pods -l k8s-app=cilium \
  --field-selector spec.nodeName=kind-worker -o name)
kubectl -n kube-system exec $AGENT -c cilium-agent -- bpftool net show

You'll see cil_from_container on each lxc…: it's the program that processes everything leaving a pod. Finally, watch the trip with Hubble:

kubectl exec alpha -- ping -c 2 $(kubectl get pod beta -o jsonpath='{.status.podIP}')
hubble observe -P --from-pod default/alpha --protocol icmp --last 4
Good to know. Since Cilium 1.16 there's an alternative to veth: netkit (Linux 6.7 or later), which runs eBPF inside the pod's namespace and gains performance. You'll see it in chapter 8.

The golden rule between nodes

Kubernetes requires that any pod can talk to any other by its IP and without NAT: the destination sees the source's real IP, and the source reaches the destination by its pod IP. Between nodes, that means someone has to know where each PodCIDR lives. Cilium offers two models:

Native routing versus encapsulation In native routing, the node routing table sends the pod network of each remote node to that node's IP and the packet travels as is, so the underlying network must know pod addresses. In encapsulation mode, the original packet is wrapped in an outer IP header between node addresses, a UDP header on port 8472 for VXLAN or 6081 for Geneve, and a tunnel header that carries the source identity. NATIVE ROUTING kind-worker172.18.0.3 kind-worker2172.18.0.4 · 10.10.0.32/27 route: 10.10.0.32/27 via 172.18.0.4 IP pod → pod · payload the network must know the pod ranges · auto routes on a shared L2, static routes or BGP ENCAPSULATION · DEFAULT kind-workercilium_vxlan kind-worker2cilium_vxlan tunnel between nodes outer IPnode → node UDP 8472Geneve: 6081 VXLAN · VNI= source identity IP pod → podoriginal packet, unchanged the network only sees node-to-node traffic · about 50 bytes of overhead per packet

Native routes versus a tunnel, with the layers of the encapsulated packet. Diagram: The House of Routing.

Native routing

The packet leaves the pod and the host routes it with its routing table, like any other traffic. For that, each node (or the physical network) has to know which PodCIDR is on which node. You turn it on with two required values:

# values-native.yaml
routingMode: native
ipv4NativeRoutingCIDR: 10.0.0.0/8   # range the network already knows how to route: no NAT
autoDirectNodeRoutes: true          # Cilium installs the routes between nodes

There are three ways to distribute the routes:

MethodHow it worksWhen to use it
Automatic routesautoDirectNodeRoutes: true: each agent adds routes to the other nodes' PodCIDRsAll nodes on the same layer 2 network
Static routesYou add them yourself with ip route add or with a configuration toolSmall labs whose nodes don't change
BGPEach node advertises its PodCIDR to the network's routersProduction with many nodes or racks (chapter 10)

With automatic routes, each node points the other nodes' blocks to the owning node's IP:

helm install cilium cilium/cilium --version 1.20.3 -n kube-system -f values-native.yaml
cilium status --wait

# 10.0.x.0/24 via 172.18.0.x : one route per neighbor node
docker exec kind-worker ip route | grep "^10\."

A static route does the same thing by hand, node by node:

# On kind-worker: kind-worker2's block is reached through its node IP
ip route add 10.0.2.0/24 via 172.18.0.4 dev eth0

It works, but it doesn't scale: every time a node joins or leaves, you have to touch all the others.

Encapsulation: VXLAN and Geneve

In many clouds and shared networks you can't teach the network your pod ranges. That's what encapsulation is for, and it's Cilium's default mode: the nodes form a mesh of tunnels and the pod's packet travels wrapped inside a regular node-to-node packet. The network only sees node-to-node traffic.

# Tunnel mode and protocol
cilium config view | grep -E "routing-mode|tunnel-protocol"

# Routes to remote PodCIDRs point to cilium_host; from there eBPF encapsulates
docker exec kind-worker ip route | grep cilium_host

# Which node (tunnelendpoint) each pod block goes to
kubectl -n kube-system exec ds/cilium -- cilium-dbg bpf ipcache list | grep tunnelendpoint

The encapsulated packet carries four layers:

  1. Outer IP: node to node.
  2. UDP: port 8472 for VXLAN (the IANA port is 4789, but Cilium uses 8472) or 6081 for Geneve.
  3. Tunnel header: Cilium uses the VNI field to carry the source pod's security identity. The destination node enforces policies without having to look it up.
  4. Original packet: pod to pod, untouched.
VXLANGeneve
UDP port in Cilium84726081
Extra metadataNoYes, with TLV fields (used by DSR, chapter 8)
How to turn it onDefaulttunnelProtocol: geneve

The number carried in the VNI is the same one you see in the identity resources:

kubectl get ciliumidentities
kubectl get ciliumidentity <ID> -o yaml   # you'll see the pod's labels
Good to know. Encapsulation costs about 50 bytes per packet, which reduces the effective MTU. With jumbo frames (MTU 9000) that cost nearly disappears. Since Cilium 1.19, tunnels can also run over IPv6.

How to choose

SituationChoose
You don't control the network (cloud, shared network)Encapsulation with VXLAN
You need metadata in the tunnelGeneve
Nodes on the same layer 2 networkNative with autoDirectNodeRoutes
Data center with BGP routersNative with BGP
You want maximum performance and pod IPs visible on the networkNative

Challenge

Answer before you open the solution.

1. Where does the eBPF program that processes traffic leaving a pod run?

On the host end of its veth pair (the lxc… interface), with the cil_from_container program.

2. Two pods on the same node ping each other. Does the traffic go through cilium_vxlan?

No. Traffic within a node is delivered through the host namespace, without encapsulation.

3. Which two values are required for native routing?

routingMode: native and ipv4NativeRoutingCIDR (or its IPv6 equivalent), the range the network already knows how to route.

4. What does Cilium carry in the VNI field of VXLAN and Geneve?

The source pod's security identity, so the destination node can enforce policies without looking it up.

What you take away

  • Each pod connects to the host through a veth pair; Cilium puts eBPF on the host side.
  • Within a node there's no tunnel: eBPF delivers the packet directly.
  • Between nodes, no NAT: either the network knows the PodCIDRs (native) or they're hidden in a tunnel (encapsulation).
  • VXLAN uses UDP 8472, Geneve UDP 6081; both carry the source identity.
  • Native gives more performance; encapsulation works on any network.

In the next chapter: services. How Cilium replaces kube-proxy with eBPF, why it keeps working even if the agent goes down, and how to give your services external IPs.

Official resources

Source and credits. This chapter summarizes and paraphrases the official book Cilium: Up and Running by Nico Vibert, Filip Nikolic and James Laverack (O'Reilly Media, 2026). The summary was produced with AI and reviewed, verified and approved by Jesús Espinoza. The diagrams and code examples are original work by The House of Routing and were checked against the official Cilium documentation. Cilium: Up and Running, the cover image, and related trade dress are trademarks of O'Reilly Media, Inc. This content is not affiliated with or endorsed by O'Reilly Media or Isovalent.

Navigate