⎈ Kubernetes Bare Metal - Introduction ⎈

⎈ Kubernetes Bare Metal - Introduction ⎈#

400 words | 5 min read


I decided to try my hand at installing Kubernetes on a few small computers in my home lab. I did not want to virtualize anything, to reduce the number of layers of virtualization.

I decided to build a 3-node cluster with a Raspberry Pi 4 as the master node (or Control Plane) and a couple of Small Form Factor PCs as the worker nodes

After a lot of reading, and trials and errors, I finally decided to set up the following:

  • K3S

  • Cilium for the CNI and Load Balancer

  • Longhorn for in-cluster persistent storage

Additionally, I also decided to configure BGP on my router (OPNSense) and to use the Kubernetes Gateway API (instead of Ingress) to expose the various services.

A lot of what I learnt, came from other articles and posts, among them:

  1. How to Install Kubernetes on Rocky Linux 9 | AlmaLinux 9

  2. Kubernetes LoadBalance service using Cilium BGP control plane

Additionally, I read a lot of the documentation for Kubernetes, Longhorn, OPNSense… and eventually came up with a set of steps to set up everything the way I wanted.

So, here are the main steps in putting everything together:

  1. Install Almalinux on each node (The RPi4 as well as the mini PCs)

  2. Configure BGP networking

  3. Install K3S on the master node

  4. Install k3s on the worker nodes

  5. Install Cilium

  6. Enable Hubble Observability & Gateway for external access to the UI

  7. Install Longhorn Gateway for external access to the UI

  8. Configure persistent storage in Longhorn for NGinx

In the next few articles, we will go through each of these steps in more detail.

Note

I also tested the cluster with k8s before going with k3s. The steps are a bit different to install k8s, but you can get a working baremetal k8s cluster too, if you wish.

I built, destroyed and re-built the cluster so many times before I got it to my satisfaction that I ended up with a number of scripts and configuration files to make my life easier.

Today, I am able to create the cluster in about 30-40 minutes, with most of the time being in waiting for the pods to finish starting. I will share these too, as we go along.

I hope to also configure ansible or salt (someday) to automate the setups - but that is a project for another day.

I hope these steps will help you set up a Kubernetes cluster for your own Journey in using Kubernetes for your own purposes.