RKE2 with Cilium CNI - Production-Ready Configuration Guide
This comprehensive guide covers deploying a production-ready Kubernetes cluster using RKE2 (Rancher Kubernetes Engine 2) with Cilium as the Container Network Interface (CNI). This configuration provides advanced networking capabilities, built-in load balancing, ingress control, and observability features through Hubble.
Overview
RKE2 is Rancher’s next-generation Kubernetes distribution that focuses on security and compliance. When combined with Cilium CNI, it provides a powerful networking solution that can replace kube-proxy while offering advanced features like L2 announcements, ingress control, and comprehensive network observability.
This setup is ideal for production environments that need:
High-performance networking without kube-proxy overhead
Built-in ingress controller capabilities
Advanced load balancing and service mesh features
Comprehensive network observability and monitoring
Simplified cluster management
Prerequisites
Before proceeding with this configuration, ensure you have:
A Linux server with root access (minimum 4GB RAM, 2 CPU cores)
Network connectivity between nodes (if multi-node setup)
Helm 3.x installed on your system
Basic understanding of Kubernetes concepts
Container runtime properly configured (for alternatives to Docker, see our containerd setup guide)
For package management on Arch Linux systems, refer to our pacman cheatsheet.
Core Components
RKE2 Server Configuration
The RKE2 server requires specific configuration to work optimally with Cilium. The key aspects include disabling the default CNI, kube-proxy, and ingress controller to allow Cilium to handle these functions.
Create the RKE2 configuration file at /etc/rancher/rke2/config.yaml:
gatewayAPI.enabled=true - Enables Kubernetes Gateway API support
Deployment Process
Step 1: Install RKE2 Server and Agent
Download and install RKE2:
# for server installationscurl -sfL https://get.rke2.io | sh -# for agent installationscurl -sfL https://get.rke2.io | INSTALL_RKE2_TYPE="agent" sh -
Create the configuration directory:
mkdir -p /etc/rancher/rke2
Create the configuration file with the YAML content above
RKE2 Server Configuration
The RKE2 server requires specific configuration to work optimally with Cilium. The key aspects include disabling the default CNI, kube-proxy, and ingress controller to allow Cilium to handle these functions.
Create the RKE2 configuration file at /etc/rancher/rke2/config.yaml:
This RKE2 setup works seamlessly with various container runtimes. While RKE2 includes containerd by default, you can also configure alternative runtimes. For detailed container runtime setup and management, including rootless configurations, see our containerd setup guide.
L2 Announcements Configuration
For environments requiring L2 load balancing, create a CiliumL2AnnouncementPolicy:
Consider container runtime security best practices (detailed in our containerd guide)
Integration with Existing Infrastructure
Container Runtime Considerations
RKE2 includes containerd as the default container runtime, but understanding container runtime concepts is crucial for advanced configurations. For comprehensive container runtime management, including rootless setups and Docker alternatives, refer to our containerd setup guide.
Related Kubernetes Deployments
This RKE2 with Cilium setup provides an excellent foundation for various Kubernetes workloads. For specific deployment guides, check our other Kubernetes resources:
Container registry deployment
Monitoring and observability stack setup
GitLab deployment on Kubernetes
Network Integration
The network configuration in this guide integrates well with existing infrastructure. For additional networking tools and configurations, see our UFW firewall cheatsheet for securing your cluster.
Q: What is RKE2 and why use it with Cilium?A: RKE2 is Rancher’s next-generation Kubernetes distribution focusing on security and compliance. Combined with Cilium CNI, it provides advanced networking capabilities including kube-proxy replacement, built-in ingress control, and comprehensive observability.
Q: How do I disable the default CNI in RKE2?A: Set cni: "none" in the RKE2 configuration file (/etc/rancher/rke2/config.yaml) to disable the default CNI plugin and allow Cilium installation.
Q: What does kubeProxyReplacement do in Cilium?A: When enabled, Cilium completely replaces kube-proxy functionality, providing better performance and additional features like direct server return and advanced load balancing.
Q: How do I enable Hubble for network observability?A: Enable Hubble by setting --set hubble.enabled=true, --set hubble.relay.enabled=true, and --set hubble.ui.enabled=true in the Helm installation command.
Q: What are L2 announcements in Cilium?A: L2 announcements enable Cilium to advertise service IPs at the L2 network level, providing load balancing capabilities without requiring external load balancers.
Q: How do I access the Hubble UI?A: Use port forwarding: kubectl port-forward -n kube-system svc/hubble-ui 12000:80 and access http://localhost:12000 in your browser.
Q: What IP ranges should I use for cluster-cidr and service-cidr?A: Use non-overlapping private IP ranges. Common examples: cluster-cidr: “10.40.0.0/16” for pods, service-cidr: “10.41.0.0/16” for services.
Q: How do I troubleshoot Cilium connectivity issues?A: Run connectivity tests using kubectl exec -n kube-system -ti ds/cilium -- cilium connectivity test and check network flows with Hubble observability tools.
Q: Can Cilium replace the default ingress controller?A: Yes, Cilium includes a built-in ingress controller. Enable it with --set ingressController.enabled=true and disable the default RKE2 ingress controller.
Q: What are the minimum system requirements for this setup?A: Minimum 4GB RAM, 2 CPU cores, and sufficient disk space. For production environments, consider higher specifications based on workload requirements.