I’ve recently built myself a Raspberry Pi4 cluster with the goal of learning more about Docker, Docker Swarm and Kubernetes.

So below I’m going to list the parts I’ve used with links to get them (I don’t make money from any links), along with why I chose them etc.

Raspberry Pi’s are a relatively inexpensive way of achieving this and they are extremely frugal with power consumption. Besides that it’s just fun to have a bunch of servers to play with!!

My home lab already has two Raspberry Pi4 (4GB) units, plus a couple of HP Micro-servers.

Raspberry Pi4 (£54 each)

RaspberryPi.org

I’ve chosen the Raspberry Pi 4 (RPI4) since it’s not much more expensive than the RPI3 but has a huge amount more CPU power and is not limited to a maximum of 2GB RAM.

There are plenty of other benefits such as the fact that the Gigabit Ethernet port is no longer sharing the USB bus (this resulted in the RPI3 never getting near gigabit speeds).

Personally, I’ve gone for a 4GB because of the intention to run virtualised workloads (Docker, Kubernetes) but my non-cluster RPI’s are also 4GB on the grounds that I can always re-purpose them to tasks requiring less than 4GB of RAM but if I buy a 2GB RPI4 then I am stuck with that maximum memory headroom.

Power Supply (£25-35)

The Raspberry Pi foundation only recommend and support using the official RPI power supply which is around £8 (so for 4 RPI nodes that’s £32 and for 6 nodes it’s £45).

This is because the RPI4 revision v1.1 (the first released version of board) wasn’t actually USB-C compliant and so would mis-behave if chargers implementing e-marked cables. These sorts of chargers and cables are designed to intelligently negotiate with the connected device to establish communication and charging etc. Because of this the RPI4 would be seen as an audio device and so wouldn’t be provided enough power.

Note, however, that there is now a revision v1.2 which reportedly resolves this issue; just good luck finding them because suppliers are understandably reluctant to identify them and then end up with a bunch of revision v1.1 stock that they cannot sell.

In any case, I am not particularly thrilled about the idea of having numerous ‘wall-wart’ power sockets. There are a number of options out there including hooking up old PC power supplies but these are more orientated for people who are going to draw the maximum amperage for the board.

The Raspberry Pi documentation recommends a 5v 3A power supply.

“Typical bare-board active current consumption” is 600mA and the “Maximum total USB peripheral current draw” is 1.2A which gives a total of 1.8A.
Standard USB chargers today are around 2.4A which leaves us with a headroom of 600mA.

Your draw may be higher depending on what you connect to the Pi but since I run all my Pi’s headless with a single fan then 2.4A should be sufficient.

Then I opted to use an Aukey 60w charger device which allows you to power 6 RPI’s but only use up one wall-socket:

Something to note is that only two ports go up to 3A and, therefore, if you think you’re going to draw that much then you need to look into other options like either the official charger or jury-rigging a PC power supply unit, as pretty none of these sorts of chargers will do true 3A output on all ports simultaneously.
There are also cheaper models out there; for example, this Anker 60w unit will likely do a good job (although I haven’t tried it).

Enclosures / cooling (£0-20)

There are three main ways to go here:

Bare-board

This is fine for tinkering etc but if you want to load up the CPU’s then you really need some sort of cooling.
Also, the boards will be physically vulnerable and get rather dusty!

Individual cases

My existing two RPI4s have different cases:

One is a straight-forward case (Pibow Coupé 4 – Ninja @ £9) with a cut-out for a fan in the top. On this one I’m using the PiMoroni fan shim (@£9.90).
It works well and has the advantage that the fan can be thermally controlled.

I also have a heat-sink case (@ £12) where the case actually acts as heat-sink and protection. These are awesome from a design perspective but they also look amazing and come in some great colours (particularly handy if you want to colour-code host-names, cables and so-on!).

Cluster / stack cases

There are a few of these on Amazon but I went for this one @ £19.99:

It looks great and is sturdy!
Only negatives are:
The assembly instructions are dire; and between that and the fact that some nuts need mouse-sized fingers to attach, I lost the will to live a couple of times during the process.
The fans are on the noisy side (but, then, silent computing is a big deal for me).

Moreover, you can’t control the fans and so they are on all the time! This is because each fan has two connectors (ground and 5v live) and the RPI has two 5v GPIO pins (pins 2 & 4) but those pins cannot be switched on and off!
Contrast that with the PiMoroni fan shim which connects to pins 1-12 and can be controlled via a Python script/Systemd service).

Cables: Power

Make sure you get good quality cables. You can save some money here but I like my cables durable and to have a nice tight fit in the USB-C sockets on the RPI’s so they aren’t likely to get yanked out by accident.

Cables: Networking

Unless you are going to connect these RPI’s to a switch over 100m away then it doesn’t really matter what category of Ethernet cable that you go with (Cat5e, 6e and so on) or whether they are Shielded.

What does make a difference, especially on very short cables (10-20cm), is the shape of the cable itself:

Round cables provide a lot of resistance to being bent relative to the weight of the RPI and so you can find that the cables cause the RPI’s to move around when cables are jostled; or that a particularly inflexible cable might cause your RPI to hang off the surface by its Ethernet port.

The solution is simple; flat cables!

Not only do they avoid this problem unique to such light-weight devices but they also look an awful lot nicer too.

Storage

RPI’s don’t come with any storage and so you’re going to want to buy some.

The default media type is an SD card. But not all are created equal!

There is a great blog where Jeff Geerling has tested a whole bunch of cards.

I chose the Sandisk Extreme 128GB @ £25.98 which for me was the sweet-spot of price-vs-capacity.

I hope that you have found this useful and good luck on your Raspberry Pi build!

Leave a Reply

Your email address will not be published. Required fields are marked *