Kubernetes CNI Compared: Calico vs Cilium vs Flannel - 夜莺博客

Kubernetes CNI Compared: Calico vs Cilium vs Flannel

The CNI plugin is the most expensive networking decision in a Kubernetes cluster, and it is usually made once and never revisited. All three mainstream options implement the same requirement - every pod gets a routable IP with no NAT between pods - but they program the kernel very differently. This comparison covers the data plane each one builds, what that costs, and the policy features that decide multi-tenant use cases.

The Three Rules Every CNI Must Satisfy

  1. Every pod gets a unique IP address that is routable from every other pod without NAT.
  2. Containers in the same pod share a network namespace, so they reach each other over localhost.
  3. The kubelet invokes the CNI plugin at pod setup to wire the interface; the plugin then gets out of the way, and packets are forwarded by kernel routes, iptables or eBPF programs.

Point three is the key insight for performance debates: CNI throughput is kernel data-plane throughput. The plugin binary's own speed is irrelevant once the pod is up.

Flannel - Overlay, Nothing More

# k3s: leave the CNI slot open for Calico or Cilium
--flannel-backend=none --disable-network-policy

Flannel allocates pod subnets per node and encapsulates traffic with VXLAN (or host-gw on a flat L2). It is portable, simple, and has no built-in NetworkPolicy support - so multi-tenancy needs a second plugin for policy. VXLAN encapsulation adds roughly 50 bytes of header per packet and, in published comparisons, caps throughput around 6-7 Gbps on 10G interfaces against roughly 9-10 Gbps for routed alternatives.

Calico - Route the Pods

Calico treats the cluster as a routable network. On bare metal and BGP-capable environments it advertises pod CIDRs to the physical fabric rather than encapsulating, which removes the overlay tax and keeps pod traffic inspectable with ordinary routing commands.

Node-1 advertises 10.244.2.0/24 via 10.112.0.52
! upstream switch learns the pod subnet and forwards natively

Its policy model is the richest of the three: standard NetworkPolicy plus Calico-specific policies with explicit allow/deny/log ordering, and iptables or eBPF data-plane options. If a cluster must integrate with the data-centre underlay, Calico in BGP mode is the natural fit - and the underlay side is ordinary L3 fabric design, with VTEP-style alternatives described in Linux VXLAN VTEP configuration.

Cilium - eBPF Everywhere

Cilium replaces kube-proxy with eBPF programs, supports native routing, GENEVE tunnelling or WireGuard/IPsec encryption, and enforces policy from L3 up to L7 HTTP rules without sidecars. It is the strongest default for a new production cluster in 2026, provided the kernel is modern (5.6+ for the encryption modes) and the team is comfortable debugging with cilium status and Hubble rather than iptables counters.

Choosing

  • Flannel - labs, edge k3s clusters, or any case where pure connectivity with zero policy is genuinely the requirement.
  • Calico - enterprise clusters needing strong policy, BGP integration with existing routers and predictable performance without encapsulation.
  • Cilium - performance-sensitive, security-focused platforms that want kube-proxy removal, transparent encryption and L7 visibility.

Whichever you pick, automate the day-2 work: address planning in NetBox IPAM, validation with pyATS/Genie state diffs where the pods talk to network devices, and fleet changes through Ansible network modules.

原文链接:https://dev.to/pendelabhargavasai/kubernetes-cni-complete-guide-flannel-vs-cilium-vs-calico-cloud-provider-cnis-5c6c