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.
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:
- Assign an IP address to the pod
- Set up network interfaces inside the pod
- Create routes so pods can talk to each other across nodes
- 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:
kubectl apply -f https://raw.githubusercontent.com/flannel-io/flannel/master/Documentation/kube-flannel.ymlWhat 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):
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.yamlHow 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:
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: 8080Calico's own GlobalNetworkPolicy (cluster-wide, more powerful):
apiVersion: projectcalico.org/v3
kind: GlobalNetworkPolicy
metadata:
name: deny-all-egress-except-dns
spec:
selector: all()
egress:
- action: Allow
destination:
ports: [53]
- action: DenyWhat 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:
helm repo add cilium https://helm.cilium.io/
helm install cilium cilium/cilium --version 1.15.0 \
--namespace kube-system \
--set kubeProxyReplacement=trueWhy 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:
# 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
| Feature | Flannel | Calico | Cilium |
|---|---|---|---|
| Routing | VXLAN overlay | BGP or VXLAN | eBPF |
| NetworkPolicy | ❌ | ✅ Full | ✅ Full + L7 |
| Performance | Medium | High | Highest |
| Observability | Basic | Basic | Hubble (excellent) |
| Kernel requirement | Any | Any | 4.9+ (5.10+ best) |
| Complexity | Low | Medium | High |
| Best for | Homelabs, simple setups | Production (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
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
Kong vs Nginx vs Traefik as API Gateway — Which One to Use in 2026
Choosing an API gateway for Kubernetes? Kong, Nginx, and Traefik each have different strengths. This comparison covers features, performance, config complexity, and which one fits your use case.
Agentic Networking — How Kubernetes Is Adapting for AI Agent Traffic in 2026
AI agents are the next-gen microservices, but with unpredictable communication patterns. Learn how Kubernetes networking, Gateway API, Cilium, and eBPF are adapting for agentic traffic in 2026.
AWS RDS Connection Timeout from EKS Pods — How to Fix It
EKS pods can't connect to RDS? Fix RDS connection timeouts from Kubernetes — covers security groups, VPC peering, subnet routing, and IAM auth issues.