Deploy a production-ready K3s Kubernetes cluster with MetalLB load balancer for bare metal and VPS environments. This guide provides step-by-step instructions for setting up and managing this technology on your VPS-based Kubernetes infrastructure.
Installing K3s
# Install K3s on the first server (control plane)
curl -sfL https://get.k3s.io | sh -s - \
--disable servicelb \
--disable traefik \
--write-kubeconfig-mode 644 \
--tls-san your-public-ip
# Get token for worker nodes
cat /var/lib/rancher/k3s/server/node-token
# Join worker nodes
curl -sfL https://get.k3s.io | K3S_URL=https://control-plane-ip:6443 \
K3S_TOKEN=your-token sh -
# Verify cluster
kubectl get nodes
Installing MetalLB
# Install MetalLB
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.14.5/config/manifests/metallb-native.yaml
# Wait for pods
kubectl wait --namespace metallb-system --for=condition=ready pod --all --timeout=90s
# Configure IP address pool
cat