Skip to content

Blog

Building Production Kubernetes Clusters with RKE2 and Longhorn

RKE2 & Longhorn Production Setup

  • 2 min read
  • Updated

Step-by-Step Guide: Building a Production Kubernetes Cluster with Rancher RKE2 & Longhorn

Kubernetes Cluster Architecture (RKE2)Control Plane NodesNode 1 (Leader)API ServeretcdSchedulerNode 2API ServeretcdController MgrNode 3API ServeretcdController MgrWorker NodesWorker 1kubeletkube-proxyPodsWorker 2kubeletkube-proxyPodsCanal CNI Network Layer (Pod-to-Pod Communication)Longhorn Distributed Storage LayerHA configuration with 3 control plane nodes and auto-failover

Step 1: Install RKE2

  1. Download the RKE2 installer from the official Rancher website.
  2. Run curl -sfL https://get.rke2.io | sh - on each node.
  3. Start the RKE2 service: systemctl enable rke2-server && systemctl start rke2-server

Step 2: Deploy Longhorn for Storage

Longhorn Distributed Storage IntegrationApp Pod APVC ClaimApp Pod BPVC ClaimApp Pod CPVC ClaimStatefulSetPVC ClaimLonghorn CSI Driver & EngineVolume Scheduling & Replication ManagerWorker Node 1Replica A1 & B1SSD StorageiSCSI TargetWorker Node 2Replica A2 & C1SSD StorageiSCSI TargetWorker Node 3Replica B2 & C2SSD StorageiSCSI TargetEach volume is replicated across nodes for high availability
  1. Install Helm: curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
  2. Add Longhorn repo: helm repo add longhorn https://charts.longhorn.io
  3. Install Longhorn: helm install longhorn longhorn/longhorn --namespace longhorn-system --create-namespace

Architecture Diagram

Kubernetes Cluster Architecture Diagram

Tech Notes

  • Use SSD storage for best performance.
  • Ensure all nodes have unique hostnames and static IPs.
  • Configure firewalls to allow Kubernetes ports.

How To: Verify Cluster Health

kubectl get nodes
kubectl get pods -A
kubectl get storageclass

Best YouTube Video Guides

Video Walkthroughs







Extra Resources

Common Issues & Troubleshooting

  • Node not joining: Check firewall and token.
  • Longhorn pods not running: Verify storage class and node labels.
  • Network issues: Review CNI plugin configuration.