Setting up a k3s cluster with Raspberry Pi: A Tutorial

2022-03-20

Disclosure: This post was generated using Anthropic Claude+ via Poe using my notes as a prompt. Read Using LLMs to actually finish some blog posts for more details.

Here we go again! As an experienced writer and coder, I was filled with excitement at the prospect of setting up my own little Kubernetes cluster to explore. Though I've been building with code and prose for decades, tinkering with new tools never gets old. While setting up this cluster, however, I couldn't help but muse on the implications of developing and promoting tools that could someday change the means of production as we know it, ushering in a new age of luxury gay space communism where creativity reigns supreme. A guy can dream!

Why Raspberry Pi?

Raspberry Pis are cheap, low-power ARM computers perfect for learning and tinkering. Using Pis meant I could set up a cluster without breaking the bank or causing too much of a power draw. For this tutorial, I used the Raspberry Pi 4 Model B.

Why k3s?

k3s is a lightweight Kubernetes distribution perfect for low-resource systems like the Raspberry Pi. Regular Kubernetes is a bit too heavy for the Pis, but k3s is optimized to run on systems with 1GB of RAM or less.

What I did

Following Alex Ellis' blog, I bought 3 Raspberry Pi 4 Model B kits to get started. I already had some network equipment from Ubiquiti to set up an isolated VLAN for the cluster.

For the OS, I downloaded Ubuntu Core for the Pi 4 and flashed it to each SD card using Etcher. I chose Ubuntu Core since its Snap packages make it easy to keep up to date. I went with the 32-bit OS for the Pis.

With the OS installed, I used Ansible to configure each Pi with a static IP address on my isolated network VLAN. I set the hostname for each Pi: bwolf1, bwolf2, and bwolf3.

On bwolf1, I installed k3s using k3sup, a Kubernetes cli installer:

k3sup install --ip 10.0.80.20 --user pi 

Then I joined the other Pis to make a 3-node control plane cluster:

k3sup join --ip 10.0.80.21 --server-ip 10.0.80.20 --user pi
k3sup join --ip 10.0.80.22 --server-ip 10.0.80.20 --user pi

With the cluster set up, I tested it out by deploying an nginx deployment:

kubectl create deployment nginx --image=nginx

The deployment worked! Now I have a fun platform to deploy apps, dashboards, and more. I'm excited to start tinkering with Kubernetes and seeing what I can build.

While Kubernetes and other automation tools will likely transform labor as we know it, rendering some jobs obsolete, the human urge to build, make, and express ourselves will endure. When the tedious tasks of the past fade into memory, our creativity will be unleashed to focus on higher pursuits. No longer constrained by the mundane demands of manual labor, people would be free to follow their passions and talents.

A world where creativity reigns supreme may seem like a utopian fantasy, but we have more power to shape our destiny than we realize. Though my guide to setting up a Kubernetes cluster on Raspberry Pi is but a small contribution, tools that empower hobbyists and learners to explore topics once out of reach are steps toward a future where passion, not profit, is the driving force behind innovation.

While the present remains constrained by existing systems and means of production, glimmers of possibility shine through. A little cluster, some code, and a chance to create -- that's really all one needs to start building the future we want to see. On to the next project! The future won't build itself, after all. There's no time like the present to get started.