Estimated time needed: one hour. And then several more hours to have fun with it.
Go through this section for all of your Raspberry Pis (master and nodes).
- Install Raspberry Pi OS 64-bit Lite onto an SD card using Raspberry Pi's Imager.
- In the imager options, I configured hostname, ssh, username, but not Wi-Fi. Setting up Wi-Fi disables ethernet.
- Add SD, ethernet, and power to Pi. 🔌
- After boot, configure DHCP server to assign a fixed IP (in your router).
- SSH to your pi, enable containers, iptables, and then reboot:
ssh pi-k3s-master.local -t sudo su sed -i '$s/$/ cgroup_memory=1 cgroup_enable=memory/' /boot/cmdline.txt apt-get install -y iptables-persistent update-alternatives --set iptables /usr/sbin/iptables-legacy update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy reboot
- SSH to your master node and install k3s:
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION='v1.21.11+k3s1' K3S_KUBCONFIG_MODE="644" sh -s
- I installed 1.21 because I wanted to use Rancher and it doesn't support 1.22/1.23 yet. You can omit the version number here if you don't ranch.
If you don't have any nodes, you're done.
For each node, SSH in and install k3s (it will detect it's a node based on the env vars set):
export K3S_TOKEN="$(ssh pi-k3s-master.local sudo cat /var/lib/rancher/k3s/server/node-token)"; \
curl -sfL https://get.k3s.io | K3S_URL="https://10.0.1.90:6443" INSTALL_K3S_VERSION='v1.21.11+k3s1' sh -
- The export line pulls the token from the master node, change it to your master's hostname.
- Make sure your nodes are using unique hostnames (pi-k3s-node1, pi-k3s-node2, etc).
- I did this in the Raspberry Pi Imager options.
- The
K3S_URL
seems to need an IP rather than a domain name (pi-k3s-master.local didn't work).
- You can uninstall:
- Master:
/usr/local/bin/k3s-uninstall.sh
- Node:
/usr/local/bin/k3s-agent-uninstall.sh
- Master: