Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Discovering Cilium: What eBPF Enabled in K8s Ne...

Discovering Cilium: What eBPF Enabled in K8s Networking

28/07/2026 Slides for the presentation at Japan Community Day, a co-located event of KubeCon + CloudNativeCon Japan 2026.

Avatar for Takuto Nagami

Takuto Nagami

July 28, 2026

More Decks by Takuto Nagami

Other Decks in Technology

Transcript

  1. Note: We skip these prerequisites • Kubernetes resource basics •

    Kubernetes core component basics • TCP/IP networking basics • Linux networking stack basics • eBPF (especially TC) basics
  2. “CNI” has three meanings • CNI spec (containernetworkinterface/cni) • Requirements

    for a platform • CNI plugin The most important point in this section
  3. Requirements for a platform The Kubernetes network model • Each

    pod gets its own unique IP address. • All pods can communicate with all other pods, whether they are on the same or different nodes without proxies or NAT. • + Service, Gateway, NetworkPolicy https://kubernetes.io/docs/concepts/services-networking/
  4. Inter-node comms on Cilium • Two modes, but nothing special

    ◦ Native Routing: same as Calico’s default ◦ Overlay: same as Flannel’s default • ex. GKE Dataplane V2 ◦ “implemented using Cilium” ◦ Original inter-node comms system
  5. Inter-node comms on Cilium Intra-node is what makes Cilium unique

    ! • Two modes, but nothing special ◦ Native Routing: same as Calico’s default ◦ Overlay: same as Flannel’s default • ex. GKE Dataplane V2 ◦ “implemented using Cilium” ◦ Original inter-node comms system
  6. Flannel Flannel uses Node Linux bridge to Pod Host NS

    enable intra-node bridge Pod pod comms! Pods have L2 connectivity via Linux bridge
  7. Calico When Pod is created: connect directly via veth Node1

    - 10.1.1.0/24 10.1.1.1 NIC1 Pod Host NS
  8. Calico When Pod is created: add entry to routing table

    Node1 - 10.1.1.0/24 10.1.1.1 NIC1 Pod Host NS destiation gateway 10.1.1.1/32 NIC1
  9. Calico Pods have L3 connectivity with static routes Node1 -

    10.1.1.0/24 10.1.1.1 10.1.1.2 NIC2 Pod NIC1 Pod Host NS destiation gateway 10.1.1.1/32 NIC1 10.1.1.2/32 NIC2
  10. Calico Calico uses Node1 - 10.1.1.0/24 static routing to Pod

    10.1.1.1 enable intra-nodeHost NS Pod pod comms! Pods have L3 connectivity with static routing NIC1 NIC2 10.1.1.2 destiation gateway 10.1.1.1/32 NIC1 10.1.1.2/32 NIC2
  11. Cilium NIC triggers the eBPF program Node1 NIC2 Pod2 NIC1

    This eBPF program Pod1 does literally everything Host NS
  12. Entrypoint Jump with tail call NIC triggers the eBPF program

    Node1 - 10.1.1.0/24 10.1.1.1 10.1.1.2 NIC2 Pod NIC1 Pod bpf/bpf_lxc.c Host NS
  13. kube-proxy replacement NIC triggers the eBPF program Node1 - 10.1.1.0/24

    10.1.1.1 NIC2 Pod2 NIC1 Pod Host NS bpf/bpf_lxc.c
  14. kube-proxy replacement NIC triggers the eBPF program Node1 - 10.1.1.0/24

    10.1.1.1 10.1.1.2 NIC2 Pod NIC1 Pod Lookup the Host NS dest Service bpf/bpf_lxc.c
  15. kube-proxy replacement NIC triggers the eBPF program Node1 - 10.1.1.0/24

    10.1.1.1 10.1.1.2 Hostthe NS Decide dest Pod NIC2 Pod NIC1 Pod bpf/bpf_lxc.c
  16. kube-proxy replacement NIC triggers the eBPF program Node1 - 10.1.1.0/24

    10.1.1.1 10.1.1.2 Host NS NIC2 Pod NIC1 Pod DNAT bpf/bpf_lxc.c
  17. kube-proxy replacement NIC triggers the eBPF program Node1 - 10.1.1.0/24

    10.1.1.1 10.1.1.2 NIC2 Pod Jump with Host NS tail call NIC1 Pod bpf/bpf_lxc.c
  18. NetworkPolicy (Pod1 egress) NIC triggers the eBPF program Node1 -

    10.1.1.0/24 10.1.1.1 10.1.1.2 Host NS NIC2 Pod NIC1 Pod bpf/bpf_lxc.c
  19. Delivering the packet NIC triggers the eBPF program Node1 -

    10.1.1.0/24 10.1.1.1 10.1.1.2 Host NS NIC2 Pod NIC1 Pod bpf/bpf_lxc.c
  20. Want to use bpf_redirect_peer() Forwarding directly to dest Pod, going

    through NIC2 Node1 NIC2 Pod2 NIC1 Pod1 Host NS
  21. Want to use bpf_redirect_peer() Forwarding directly to dest Pod, going

    through NIC2 Node1 NIC2 Pod2 NIC1 NIC2 can’t trigger Pod1 eBPF! Host NS
  22. Want to use bpf_redirect_peer() Forwarding directly to dest Pod, going

    through NIC2 NIC2 Pod2 NIC1 NIC1 to Node1 -need 10.1.1.0/24 handle Pod2 Pod1 ingress policy too Host NS
  23. Delivering the packet NIC triggers the eBPF program Node1 NIC2

    Pod2 NIC1 Pod1 bpf/lib/local_delivery.h Host NS bpf/include/bpf/ctx/skb.h
  24. Delivering the packet NIC triggers the eBPF program Node1 This

    is bpf/lib/local_delivery.h NIC1 bpf_redirect_peer() Pod1 NIC2 Pod2 Host NS bpf/include/bpf/ctx/skb.h
  25. Cilium eBPF delivers the packet with bpf_redirect_peer() Cilium handles packets

    entirely with Pod1 Host NS eBPF programs ! Node1 NIC1 NIC2 Pod2
  26. Pros & cons of full eBPF • Pros: customizability ◦

    Implemented in code = fine-grained control ◦ Enables very advanced optimization • Cons: complexity ◦ Cilium has to handle the full complexity of Kubernetes networking itself
  27. kube-proxy replacement NIC triggers the eBPF program Node1 - 10.1.1.0/24

    10.1.1.1 NIC2 Pod2 NIC1 Pod Host NS bpf/bpf_lxc.c