🎉 DevOps Interview Prep Bundle is live — 1000+ Q&A across 20 topicsGet it →
All Articles

Kubernetes CNI Plugins: Calico vs Flannel vs Cilium — Which to Pick?

Choosing a CNI plugin for Kubernetes? Compare Calico, Flannel, and Cilium on networking model, performance, NetworkPolicy support, and when to use each.

DevOpsBoysMay 27, 20264 min read
Share:Tweet

Every Kubernetes cluster needs a CNI (Container Network Interface) plugin to handle pod networking. Flannel, Calico, and Cilium are the three most common. Here's what each does and when to use which.


What Does a CNI Plugin Actually Do?

When a pod starts, Kubernetes calls the CNI plugin to:

  1. Assign an IP address to the pod
  2. Set up network interfaces inside the pod
  3. Create routes so pods can talk to each other across nodes
  4. Enforce NetworkPolicy rules (if supported)

Without a CNI plugin, pods can't communicate.


Flannel — Simple and Fast

Flannel is the simplest CNI. It creates an overlay network (VXLAN by default) so every pod gets an IP from a flat network.

What it does:

  • Uses VXLAN to encapsulate pod traffic
  • Each node gets a subnet, pods on that node use IPs from that subnet
  • Very low operational overhead

Install:

bash
kubectl apply -f https://raw.githubusercontent.com/flannel-io/flannel/master/Documentation/kube-flannel.yml

What Flannel supports:

  • ✅ Basic pod-to-pod connectivity
  • ✅ Works on almost any cloud/on-prem
  • ✅ Simple to troubleshoot
  • ❌ No NetworkPolicy enforcement (needs a separate policy engine)
  • ❌ Limited observability

Use Flannel when:

  • You want the simplest possible setup
  • You're running a small cluster or homelab
  • You don't need NetworkPolicy
  • Low ops overhead is the priority

Calico — NetworkPolicy Powerhouse

Calico is the most widely used CNI in production. It uses BGP routing (no overlay by default) for performance and has the most powerful NetworkPolicy support.

Install (with Tigera Operator):

bash
kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.27.0/manifests/tigera-operator.yaml
kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.27.0/manifests/custom-resources.yaml

How routing works:

  • Default: BGP — each node advertises its pod subnet to peers
  • Alternative: VXLAN overlay (for clouds that don't support BGP)
  • No encapsulation overhead with BGP mode → faster

Calico's killer feature — NetworkPolicy:

Standard Kubernetes NetworkPolicy:

yaml
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: allow-frontend-to-backend
  namespace: production
spec:
  podSelector:
    matchLabels:
      app: backend
  ingress:
  - from:
    - podSelector:
        matchLabels:
          app: frontend
    ports:
    - port: 8080

Calico's own GlobalNetworkPolicy (cluster-wide, more powerful):

yaml
apiVersion: projectcalico.org/v3
kind: GlobalNetworkPolicy
metadata:
  name: deny-all-egress-except-dns
spec:
  selector: all()
  egress:
  - action: Allow
    destination:
      ports: [53]
  - action: Deny

What Calico supports:

  • ✅ Full NetworkPolicy (standard + Calico extended)
  • ✅ BGP routing (high performance, no overlay)
  • ✅ WireGuard encryption between nodes
  • ✅ Global policies (cluster-wide rules)
  • ✅ Hierarchical policy tiers
  • ✅ Works on AWS, GCP, Azure, bare metal
  • ⚠️ More complex to troubleshoot than Flannel

Use Calico when:

  • You need NetworkPolicy (security teams require it)
  • You're running production workloads
  • You want high performance (BGP mode)
  • You need cluster-wide security policies

Cilium — eBPF-Powered, Cloud-Native

Cilium uses eBPF (extended Berkeley Packet Filter) instead of iptables. This means networking happens in the Linux kernel directly — faster, more observable, and with less CPU overhead.

Install:

bash
helm repo add cilium https://helm.cilium.io/
helm install cilium cilium/cilium --version 1.15.0 \
  --namespace kube-system \
  --set kubeProxyReplacement=true

Why eBPF matters:

Traditional (iptables-based CNIs):

Pod → iptables rules (100s of rules) → routing → destination

Cilium (eBPF):

Pod → eBPF program in kernel → destination (direct, no iptables)

At scale (1000+ services), iptables becomes a bottleneck. eBPF doesn't.

Cilium features:

  • ✅ eBPF-based (no iptables = better performance at scale)
  • ✅ Built-in Hubble observability (network flow visibility)
  • ✅ Full NetworkPolicy + CiliumNetworkPolicy
  • ✅ L7 policy (HTTP, gRPC, Kafka aware)
  • ✅ Can replace kube-proxy entirely
  • ✅ Multi-cluster networking (Cluster Mesh)
  • ✅ Service mesh without sidecar proxies (Cilium Service Mesh)
  • ⚠️ Requires Linux kernel 4.9+ (preferably 5.10+)
  • ⚠️ More complex than Calico

Hubble — network observability:

bash
# Install Hubble UI
cilium hubble enable --ui
 
# See live network flows
hubble observe --namespace production
 
# Output:
# Jan  1 00:00:00.000: production/frontend → production/backend:8080 (FORWARDED)
# Jan  1 00:00:00.001: production/backend → production/db:5432 (FORWARDED)

Use Cilium when:

  • You're running at scale (500+ nodes)
  • You want zero-trust networking with L7 policies
  • You care about network observability without a service mesh
  • You want to replace kube-proxy
  • You're building a platform (GKE uses Cilium by default now)

Comparison Table

FeatureFlannelCalicoCilium
RoutingVXLAN overlayBGP or VXLANeBPF
NetworkPolicy✅ Full✅ Full + L7
PerformanceMediumHighHighest
ObservabilityBasicBasicHubble (excellent)
Kernel requirementAnyAny4.9+ (5.10+ best)
ComplexityLowMediumHigh
Best forHomelabs, simple setupsProduction (most teams)Large scale, cloud-native

What the Major Cloud Providers Use

  • GKE: Cilium (since 2023)
  • EKS: Amazon VPC CNI (not on this list, but worth knowing)
  • AKS: Cilium or Azure CNI
  • Most on-prem clusters: Calico

My Recommendation

  • Starting out / homelab: Flannel
  • Production team, security matters: Calico
  • Large scale / observability priority / cloud-native platform: Cilium

In 2026, if you're building a new cluster and have the kernel version, Cilium is worth the learning curve. The observability from Hubble alone saves hours of debugging.


KodeKloud CKA Course — the CKA exam tests CNI plugins and networking. Hands-on labs with real Calico and Flannel setups included.

Spacelift — if you're managing EKS clusters with Terraform and need to configure the VPC CNI or switch to Cilium, Spacelift handles the Terraform automation.

🔧

Today I Fixed

Short real fixes from production — posted daily

Browse fixes
Newsletter

Stay ahead of the curve

Get the latest DevOps, Kubernetes, AWS, and AI/ML guides delivered straight to your inbox. No spam — just practical engineering content.

Related Articles

Comments