K3s on Raspberry Pi is a great way to create a home Kubernetes cluster. In this guide, I will show you the complete process from system preparation to a functional cluster.
K3s on Raspberry Pi is a lightweight Kubernetes distribution from Rancher Labs, ideal for resource-constrained environments like IoT and edge computing.
Requirements for K3s on Raspberry Pi
- Hardware: Raspberry Pi 4/5 with 64-bit OS
- RAM: Minimum 512MB (2GB+ recommended)
- OS: Raspberry Pi OS Lite or Ubuntu Server 22.04 LTS (64-bit)
- Storage: microSD card or SSD
- Network: Static IP addresses
More about K3s in the official K3s documentation.
System Preparation for K3s on Raspberry Pi
System Update
sudo apt update && sudo apt full-upgrade -y
sudo reboot
Disable Swap
sudo dphys-swapfile swapoff
sudo systemctl disable dphys-swapfile
Enable Cgroups
Edit /boot/cmdline.txt and add:
cgroup_memory=1 cgroup_enable=memory
Installing K3s on Raspberry Pi – Master Node
curl -sfL https://get.k3s.io | sh -
Verify Installation
sudo systemctl status k3s
k3s kubectl get nodes
k3s kubectl get pods -A
Get Token for Worker Nodes
sudo cat /var/lib/rancher/k3s/server/node-token
Adding Worker Nodes to K3s on Raspberry Pi Cluster
curl -sfL https://get.k3s.io | K3S_URL=https://MASTER_IP:6443 K3S_TOKEN=NODE_TOKEN sh -
Testing the Cluster
k3s kubectl create deployment test-nginx --image=nginx
k3s kubectl expose deployment test-nginx --type=NodePort --port=80
k3s kubectl get service test-nginx
Summary
K3s on Raspberry Pi is an efficient solution for a home Kubernetes cluster. Key points:
- Lightweight distribution ideal for ARM devices
- Simple one-command installation
- Swap must be disabled
- Cgroups are required for resource management
More guides on virtualization in our section.
Odborník na kybernetickú bezpečnosť, správu Azure Cloud a VMware onprem. Využíva technológie, ako Checkmk a MRTG, na monitorovanie siete a zvyšovanie efektívnosti a bezpečnosti IT infraštruktúry. Kontakt: hasin(at)mhite.sk
