Configure Cilium CNI with eBPF for High Network Performance in VPS Micro Cluster
Detailed guide on configuring Cilium CNI with eBPF for high network performance in a VPS micro cluster, including setup, testing, and optimization.
Image credit: cegoh · Pixabay Content License
Introduction to Cilium CNI and eBPF
Cilium is a powerful Container Network Interface (CNI) solution built on eBPF (extended Berkeley Packet Filter), enabling high network performance, security, and observability for containerized environments in Kubernetes. By running directly in the Linux kernel, eBPF allows Cilium to process network traffic without context switching between user and kernel space, reducing latency and improving throughput.
In VPS micro clusters—where resources are limited but performance demands are high—Cilium with eBPF is an ideal choice to optimize networking, especially when routing traffic, enforcing security policies, and monitoring real-time performance is critical.
Requirements and Setup
- 3 or more VPS machines (minimum 2 GB RAM, 1 CPU)
- Operating System: Ubuntu 22.04 or Debian 11
- Kubernetes installed (via kubeadm or k3s)
- SSH access and sudo privileges
kubectlandhelminstalled
Configure Cilium CNI with eBPF
Follow these steps to install and configure Cilium on your VPS cluster:
1. Install Cilium via Helm
Add the Helm repository and install Cilium:
helm repo add cilium https://helm.cilium.io/
helm repo update
helm install cilium cilium/cilium --namespace kube-system \
--set eBPF.enabled=true \
--set eBPF.tunnel=disabled \
--set eBPF.ipv4=true \
--set eBPF.ipv6=false \
--set ipam.mode=cluster-pool \
--set k8sServiceController.enabled=true
2. Check Cilium Status
After installation, verify the status of the pods:
kubectl get pods -n kube-system -l k8s-app=cilium
Wait until all pods are in the Running state.
3. Optimize Network Performance
To fully leverage eBPF performance, configure kernel parameters:
# Increase socket and file descriptor limits
echo "fs.file-max = 1000000" >> /etc/sysctl.conf
echo "net.core.somaxconn = 65535" >> /etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 1024 65535" >> /etc/sysctl.conf
sysctl -p
4. Test Network Performance
Use ping and iperf3 to validate connectivity and bandwidth:
# Test latency
ping -c 10 <target-node-ip>
# Test bandwidth (install iperf3 on both machines)
iperf3 -s # on server node
iperf3 -c <server-ip> # on client node
Monitoring and Security
Cilium provides integrated monitoring features such as:
- Flow visibility: View traffic flows between pods
- Network policy: Define security policies between services
- Service map: Visualize services and their connections
To verify policies, run:
cilium policy get
cilium status --verbose
Troubleshooting
- Cilium pods not running: Check logs with
kubectl logs -n kube-system. Ensure the kernel supports eBPF and no modules are blocked. - No pod-to-pod connectivity: Verify policies, IPAM, and routing. Use
cilium endpoint listto inspect endpoint status. - Low performance: Monitor CPU and memory usage by Cilium. Optimize eBPF parameters if needed.
References
Recommended NVMe Cloud VPS Plans to Deploy This Setup
Enterprise RAID 10 NVMe SSDs, CMC & FPT District 9 uplinks with Anycast Anti-DDoS and 99.99% SLA.
VPS-3E
10% VAT included
- CPU: 2 vCPU
- RAM: 4 GB
- SSD: 50 GB NVMe
