This is a personal project to set a Kubernetes RPi cluster to provide me a private cloud for learning.
K3S is a highly available, certified Kubernetes distribution designed for production workloads in unattended, resource-constrained, remote locations or inside IoT appliances. Both ARM64 and ARMv7 are supported with binaries and multiarch images available for both.
- 6 SD card 32GB like SanDisk 32GB ULTRA microSDHC Card Class 10
- 6 RPi 3b+ (1 Masters and 5 Worker)
- 8-port Ethernet Gigabit Switch like Netgear GS308
- 8-way USB Power-supply
- 6 Ethernet cables
- 6 Micro-USB cables
- RPi 3B+,4B Cluster case like 8 Slot Cluster Cloud
For every RPi that we going to have in our cluster. We have to follow these steps:
I recommend you follow some kind of nomenclature in your nodes naming. It'll be helpful later when you are working with your cluster. Because of the high availability feature with an embedded DB is experimental. I decided only to use one Master node in my cluster.
- Download Raspbian Lite
- Flash SD card using Etcher
- Mount the SD card and create a text file named "ssh" in the boot partition.
Insert the SD card and turn on your RPi. It will be accessible on your network over ssh using the following command:
ssh pi@raspberrypi.local
Log in with the password "raspberry" and then type:
sudo raspi-config
Do the following actions:
- Set the GPU memory split to 16mb
- Set the hostname
- Change the password for the pi user
ifconfig | grep -i inet
sudo nano /etc/dhcpcd.conf
Add to end of this file:
interface eth0
static ip_address=192.168.2.xxx/24
static routers=192.168.2.1
static domain_name_servers=192.168.2.1
edit /boot/cmdline.txt
sudo nano /boot/cmdline.txt
and add the following to the end of the line:
cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory
Now reboot the device:
sudo shutdown -r now
Copy public key to the RPi
ssh-copy-id pi@k3s-paasmonkey-n0x.local
Now you can rely on your public key to log into each RPi without typing a password in.
Because of the high availability feature with an embedded DB is experimental. I decided only to use one Master node in my cluster.
SSH to you our RPi Master
ssh pi@k3s-paasmonkey-m01.local
Install our Master node in our RPi
export SERVER_IP=192.168.2.120
export USER=pi
k3sup install --ip $SERVER_IP --user $USER
SSH to our RPi Master
ssh pi@k3s-paasmonkey-m01.local
Copy public key to the Node
ssh-copy-id pi@k3s-paasmonkey-n0x.local
Join RPi Node to the RPiCluster
export AGENT_IP=192.168.2.xxx
export SERVER_IP=192.168.2.120
export USER=pi
k3sup join --ip $AGENT_IP --server-ip $SERVER_IP --user $USER
Here you can see how deploy an API Gateway in our cluster.
- Will it cluster? k3s on your Raspberry Pi
- Inlets Operator — Exposing Services on Private Kubernetes Clusters with a Public IP
See the LICENSE file for license text and copyright information.