A cluster of Raspberries (k3s): Part 1 – Hardware

Probably the easiest way to use a computer cluster today is (at least at the moment) Kubernetes. And even tough this is some text on a website and I’m probably miles and miles away from the reader, I can already hear the first people scream: But Felix, a tiny tiny SoC computer like the Raspberry Pi, even in RPI4 guise with 8 GB of RAM is a bad base, technically inefficient, slower than my laptop aaaaaaand so on and on and on and on….

And yes. Strictly speaking there are quite a lot more systems available which would be a better, more powerful basis for a Kubernetes cluster then a bunch of Raspberry Pis. But let’s be honest here: we’re not building some high-availability production grade mega-cluster for a Forbes 500 company. And that is also REALY not the point of this tutorial. This (at least for me) was a lot of fun to figure out and tinker with and I learned a LOT of stuff I can use with “real” clusters in my job. Also there is nothing better to confuse the hell out of some visiting luddites than a shelf full of PCBs with blinking LEDs. They will think you are capable of some kind of black-magic 😀

But to put it in some more realistic terms: A cluster of Raspberry Pis is a nice platform for hosting some small services for your home network and maybe some future projects, be it home automation, app development (Version control with Gitea for example) and just some basic comfort features for your home network like for example an instance of pi-hole to block ads in your entire network.

So why the hell not? 😀

Okay, now that we have agreed on building the damn thing, even if it’s just for the hell of it, the first question is going to be: Which version of Kubernetes do we want to use? The “full” version (the original k8s if you want) is apparently able to run on a bunch of Raspberries, even in a useful fashion, but since there are more compact versions available (for “edge computing”, whatever the hell that means), I would suggest either k3s by SUSE (https://k3s.io) or microk8s by Canonical (https://microk8s.io). Since we want to have as much of the power that’s available on the Raspberry Pis available for use with services running on the cluster, these make more sense than the “full” version. For this series of HowTo’s I decided to use k3s.

What we need:

Okay, we have decided to give the little raspberry some colleagues to work with on our random ideas, we will of course need material first. Here is some stuff I would recommend or stuff I use myself (the links are affiliate links, so I would get a small provision if you buy using those):

  • You will at least need two Raspberry Pi 4. I would strongly recommend the 8GB version, but you might get away with the 4GB version.
  • Obviously, you will need at least one SD card for each Raspberry. The card should be on the bigger side, but more than 3264GB should not be necessary. We will use a NAS to store data from the services.
  • Considering the fact that a cluster needs to be able to shove data as quickly as possible from node to node, I strongly recommend some ethernet cables. WiFi is not ideal for this situation.

So that’s the obligatory stuff dealt with. You could now buy a whole bunch of power supplies and get going with the next chapter, or take a peek at additional stuff I use and can recommend using. These things have proven themselves to be useful, but are not actually required.

If you stick to the basic BoM and want to use more than two nodes, you might just end up with a gordian knot of wires… And your home router does not have an endless supply of LAN sockets. The solution?

POE!

Well, strictly speaking it’s POE+.

POE stands for Power Over Ethernet (the “+” part of POE+ just means MORE POWER). Using this acronym (or rather the tech behind it) can supply our bundle of raspberries with power using the ethernet cable. So no seperate power supply required and about a million miles of cable saved (at least it feels like that sometimes). But for that to work, we need two things:

  • A POE+ capable network switch
  • A POE+ Hat for each Raspberry Pi. I myself use the original POE+ hat made by the Raspberry Pi Foundation, but it looks like that one is not easily available at the moment. But the only important part is, that the hat you pick follows the IEEE 802.3at Standard and NOT the regular POE version (IEEE 802.3af).

That is pretty much it as far as material is concerned. You might want to take a look at some kind of case (otherwise it get’s very chaotic very quickly, believe me), but that’s not as easy as it sounds. Most cases are not meant to be used with a POE+ hat (which can add quite a bit of height, depending on the hat). An easy version might be something like  this. It might not be possible to use the “case” as pictured, but the standoffs provided at least allow the height between the different levels to be adjusted. For all the owners of 3D printers, I can recommend a peek at thingiverse. There are a million and one different kinds of cases available on there for download, so you might just find something that fits your needs. If you want to spend money, you can even get some ready made mountings for 19 inch racks.

That’s the Hardware side dealt with. The next chapter will look at the software setup using Raspberry Pi OS lite, k3s and the rancher dashboard.