/kluster-pi

A set of instructions and scripts to learn and practice around the creation of a Kubernetes cluster running on Raspberry Pi boards

Primary LanguageShellApache License 2.0Apache-2.0

K8S cluster on Raspberry Pi

This project allows everyone to easily build a Kubernetes cluster using Raspberry Pi and Rancher's k3s.

I initially created it for my own personal use, to experiment with cloudnative-pg, longhorn, and to run my own cloud services using nextcloud. Now I'd like to share the knowledge I gained and the collection of bash scripts with anyone is interested in learning, practicing, and improving this project.

kluster

Minimum Requirements

Hardware

  • x3 RPi 8GB RAM (I used v4)
  • x3 SD cards
  • x3 SSD disks
  • x3 SATA to USB-3
  • x1 network switch (4 ports)

Power adapters/cables, and network cables are omitted, but required.

hardware 1

hardware 2

Distribution

Procedure

Follow the procedure in the docs/ directory:

  1. Update RPi4 Firmware (when necessary)
  2. Install Debian for RPi
  3. Clone image on SSD and mount it as root
  4. Prepare RPi nodes installing and configuring packages
  5. Setup cluster installing k3s on each node

Scripts

  • install-sd.sh - writes distro image to SD card, adds SSH key, configures hostname, downloads rpi-clone repo inside /root
  • install-kluster.sh - install k3s and deploy required resources on the cluster following the correct procedure
  • init-k3s-master.sh - install and deploy the first k3s master
  • join-k3s-master.sh - install and deploy a new k3s master to join the cluster
  • join-k3s-agent.sh - install and deploy a new k3s agent to join the cluster
  • deploy-resources.sh - install the specified resources in the resources.list file

Sources

Raspberry Pi

Kubernetes

Network

Load Balancer

Storage

Ingress

Database