I was using a couple of Raspberry Pi4 4GBs and one Pi3+ single board computers for various tasks within our home network:

It occurred to me that I wasn’t fully utilizing the hardware. So I’ve decided to build a Pi4 cluster. I wanted learn more about docker and cluster computing.

HARDWARE

The Pi4 4GB has a later generation, faster 64 bit, 4 core CPU, and 4 times the memory of the Pi3b+ that’s currently running my Pihole DNS. It also moved Ethernet off of the USB bus removing a major network performance bottleneck compared to the Pi3b+.These improvements make the Pi4B a much better fit for this use case. Plus, I had two on hand already. Frugality is always a plus.

I haven’t decided if I want to make use of the Pi3b+ in this project because of it’s performance constraints. I will eventually add it to the case and use it to run foldforcovid.io, but probably will not add it to the docker swarm. That’s a great project if you have a spare computer and want to use it to help find a cure for COVID-19.

The cluster case was inexpensive when compared to more advanced cases like the Cloudlet case which sells for $69. You do need to disassemble the case to add/remove boards with the cheaper case, but I didn’t foresee a need to do that very often. The GeeekPi case did come with a full complement of Pi3 and Pi4 heatsinks for 4 boards.

The D-Link Switch was supports gigabit and uses a 5V DC power supply. It can also run off the USB charging station with a bit of creative cable modification. Most USB cables use red for +5V. Check the power adapter specs to verify the where the +5V is. Mine had a stripe on the +5V wire from the AC adapter to make it simple.

Edit: I decided to go with the $7 USB A to barrel connector cable after the switch lost power a couple of times. I didn’t have the right size butt connectors to join the power supply wires to the much smaller USB wire, they kept slipping out. The pre-made cable makes it look better as well.

Another valid choice would be using a PoE switch instead. That would require obtaining 3 PoE hats, as well as a compatible PoE Ethernet switch. The PoE switches sell for $50 – $60 on Amazon. The Pi PoE hats are ~$20 each. That would eliminate the USB cables and the charging station and leave just the ethernet cables.

As a point of comparison, the Picocluster 3H with three Pi4s and 3 x 32gb SD cards is $444 if you want to assemble it yourself. It’s $499 if you want it already assembled. Add $20 for US shipping.

The storage for my FrakenPi is a Mediasonic ProBox HF2-SU3S2 4 Bay 3.5” SATA HDD USB 3.0 Enclosure with a pair of 2TB drives, plus a 3TB drive. The pair of 2TB drives are setup has a RAID-1 array and the 3TB is used as an Apple formatted Time Machine backup. This is used to host video files, photos, backup and, a Bittorrent service using Transmission. It takes advantage of the Pi4 USB 3.0. It also supports connection via external SATA. I may pull the old 2TB drives and replace them with 4TB Seagate Ironwolf HDDs. I did pull the existing drives out of an old NAS and an old Western Digital external HDD I had. Frugality is my friend.

SOFTWARE

There are dozens of tutorials on how to do this. I rather like the approach taken by HackViking using Docker Swarm and Swarmpit. I’m going to start there. That will be my first pass learning experience. I may decide redo the whole thing with k3s lightweight Kubernetes instead. My goal is to learn about cluster computing. There will be no mistakes. Because every mistake is a learning experience.

This is what it looks like after the build:

FrankenPi