Hello! I'm going to show you how to set up a lightweight Kubernetes cluster using K3s and k3sup (pronounced "ketchup"). This is way easier than manually SSH-ing and running init commands on your server.
I use k3s as a lightweight alternative to stock Kubernetes. It's great for small clusters - such as the one I host on Hetzner.
First, grab k3sup using this command:
curl -sLS https://get.k3sup.dev | sh
sudo install k3sup /usr/local/bin/
Here's how to install K3s on your remote server:
export IP=<your-server-ip>
k3sup install --ip $IP --user root
That's literally it. k3sup will SSH into your server, install K3s, and download the kubeconfig file to your local machine.
Let's make sure everything's working:
export KUBECONFIG=/Users/$(whoami)/kubeconfig
kubectl get nodes
You should see your node listed as READY. Pretty cool, right?
K3s is perfect for dev environments and small projects because:
Now you can start deploying your apps! Here's a quick test deployment:
kubectl create deployment nginx --image=nginx
kubectl expose deployment nginx --port=80 --type=LoadBalancer
kubectl get svc
Also, if you interact with multiple k8s clusters, remember to name the context something unique.
If something goes wrong, check these common issues:
Happy clustering 🚀
All blog posts