jkleinkauff / raspk8s

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This repo intends to help me when I need it to setup my raspberry cluster again. The process is not hard at all, but some tools and apps have some details that I will certainly forget.

  1. New Raspberry Setup
    1. Upgrade
    2. Static IP
      3. Raspbian
      3. Debian
    3. SSD
  2. Tools
    1. k3s
      1. Install
      2. Master node Token
      3. Worked node Setup
    2. metalb

Setup a new raspberry

  • use the official Raspberry Imager
  • image: select OS 64 Lite
  • config: for my case, I prefer to enable just the ssh through GUI and enable Wifi with wpa_supplicant.conf

Use a good quality usb-c cable. Sometimes the rpi will fail to read the sd card, in my case, it was a faulty usb cable. Seriosly.

Upgrading

1 - Discover your rpi IP through your gateway and SSH into it

sudo apt update
sudo apt full-upgrade
sudo reboot

Set a static IP

Raspbian

  • vim /etc/dhcpcd.conf
interface wlan0
static ip_address=192.168.15.180/24
static routers=192.168.15.1
static domain_name_servers=8.8.8.8

where interface, routers will depend of wifi/eth and your router gateway.

Debian 11+

nmcli con add con-name "anyname" type wifi ifname wlan0 ssid "<ssid>" -- wifi-sec.key-mgmt wpa-psk wifi-sec.psk "<password>" ipv4.method manual ipv4.address 192.168.15.190/24 ipv4.dns 8.8.8.8,8.8.8.4 ipv4.gateway 192.168.15.1

Raspberry from an SSD

With rpi-clone it's possible to copy your SD card to a newly formatted SSD drive. The approach that worked for me is to first create the SD card with the Raspberry Imager, make sure it is working and you can SSH, then run rpi-clone.

  • Create an SD card with your image
  • Make sure you can boot with it and SSH
  • Use rpi-cloner to copy SD card content into the SSD drive
  • Run raspi-config and change boot order (A6)
  • Shutdown your rpi
  • Unplug the SD card and left only the SSD.

Tools

k3s

I choose k3s as my main kubernetes flavor just for testing purposes. And, as the cluster itself does not have much RAM available, I thought it would be a good idea to experiment with something lighter than the official.

Install

k3s come with their load balancer and lb service named traefik and klipper, respectively. Although I have never play with them before, I want my cluster as close as possible to what we do on Cloud, so I chose nginx with MetaLB. Install k3s without the default tools:

curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="server --no-deploy=traefik --disable servicelb" sh -s -

Get master node token

cat /var/lib/rancher/k3s/server/node-token

Install k3s on a worker node

On the second raspberry - or node:

curl -sfL https://get.k3s.io | K3S_URL=https://masterip:6443 K3S_TOKEN=mastertoken sh -

Setup a new Orange PI 4/5

  • Orange PI 5 doesn't have Wifi so after checking if everything is running ok, just plug in the ethernet cable and go discover the IP.

The current version of Debian for the OPI5 has the following default users:

  • orangepi@orangepi
  • root@orangepi

Future me, now you can head to /terraform and apply the other apps.

  • metallb
  • postgres
  • kafka
  • airflow

About


Languages

Language:HCL 79.5%Language:Dockerfile 14.5%Language:Shell 6.1%