Assemble Home Lab with Raspberry Pi

Vitor Gomes
3 min readJul 8, 2024

--

Kubernetes can be a complex beast; doing is the best way to learn. I’m building a home lab to experiment and gain practical experience. I’ll be using K3s as the foundation, adding monitoring with kube-prometheus, and automating deployments with GitHub and ArgoCD. Along the way, I’ll even run .NET apps in the cluster. This series is all about my learning process—mistakes and all!

Kubernetes (k8s) is the undisputed champion of container orchestration, but its complexity can be overkill.

After two and a half years of studying Kubernetes using K8s, I realized I was using a bazooka to kill a fly. There were many weekends and early mornings creating and recreating environments to arrive at a relatively stable environment to create whatever I wanted.

In 2021, I published a Medium post detailing a step-by-step guide for installing K8s on 10 Raspberry PIs. Having to redo the entire process whenever I wanted to change something was tedious and sometimes discouraging.

Trying to streamline the environment creation process, I started studying Ansible to create a project that would automate all the K8s installation processes. Time wasn’t on my side, so I ended up looking for other solutions, and one of them was K3s.

What is K3s?

K3s is a fully compliant Kubernetes distribution with the following enhancements:

  • Distributed as a single binary or minimal container image.
  • Lightweight datastore based on SQLite3 as the default storage backend. etcd3, MySQL, and Postgres are also available.
  • Wrapped in a simple launcher that handles much of the complexity of TLS and options.
  • Secure by default with reasonable defaults for lightweight environments.
  • All Kubernetes control plane components' operations are encapsulated in a single binary and process, allowing K3s to automate and manage complex cluster operations like distributing certificates.
  • External dependencies have been minimized; the only requirements are a modern kernel and cgroup mounts.

Packages the required dependencies for easy “batteries-included” cluster creation:

  • containerd / cri-dockerd container runtime (CRI)
  • Flannel Container Network Interface (CNI)
  • CoreDNS Cluster DNS
  • Traefik Ingress controller
  • ServiceLB Load-Balancer controller
  • Kube-router Network Policy controller
  • Local-path-provisioner Persistent Volume controller
  • Spegel distributed container image registry mirror
  • Host utilities (iptables, socat, etc)

The moment I started using K3s, everything became much simpler to create. Everything I did in K8s, I could do in K3s.

Everything was already okay for me, but then I found the light at the end of the tunnel. If it was already easy, open source made creating everything even easier and faster.

In the GitHub repository, an Ansible project allows you to install k3s in less than 5 minutes after the operating system is installed.

To use it, download the repository and follow the steps. I guarantee it will be of great help to everyone. Have fun!

Note: You can create a cluster with one control plane or as a high-availability environment.

ClusterCTRL: Stack

Regarding hardware, my home lab currently consists of 9 Raspberry Pi 4s and 1 Raspberry Pi 5. Adding a Raspberry Pi 5 provided more stability to the cluster.

--

--

Vitor Gomes
Vitor Gomes

No responses yet