All blog posts

Setting Up K3s Using k3sup - The Easy Way

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.

Prerequisites

  • A remote server (I'm using a $10 Hetzner server, but you can use any provider you like)
  • SSH access to your server (You must be able to ssh into your remote machine)

Installing k3sup Locally

First, grab k3sup using this command:

curl -sLS https://get.k3sup.dev | sh
sudo install k3sup /usr/local/bin/

Setting Up K3s Server

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.

Testing Your Cluster

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?

Why This is Awesome

K3s is perfect for dev environments and small projects because:

  1. It's super lightweight (< 100MB binary)
  2. Single binary installation
  3. Low memory footprint
  4. Perfect for edge computing and IoT

Next Steps

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.

Troubleshooting

If something goes wrong, check these common issues:

  • Make sure port 6443 is open on your server
  • Verify your SSH key permissions are correct
  • Check the K3s service status with systemctl status k3s

Happy clustering 🚀

All blog posts