Notes on Building a Raspberry Pi Kubernetes Cluster (Part 1: the Hardware)
Late last year I started thinking about building a Raspberry Pi cluster. For years I’d read about people running Kubernetes on Raspberry Pis and thought that the experience of building a Pi cluster would be a great learning exercise, but didn’t want to build a cluster to just run toy projects. But when the Pi 4 appeared, I felt that the time had come to try to build something useful (and fun).
Early this year I started gathering parts; first a couple of Pi 4 boards from Adafruit, and then after looking at lots of cluster racks I found a hardware setup that I liked: the UCTRONICS Pi 4 rack mount, which lets me mount four Pi 4s in a 1U rack mount and includes adapters to bring the Pi’s HDMI ports to the front of the rack. Since I didn’t already have a rack (and didn’t want a big one), I got the StarTech 8U Desktop Rack which gives me a nice light assembly that I can easily carry back and forth between my garage workbench and my desk. It’s bigger than most Pi cluster racks but sturdy and has plenty of room for growth and change.
Power over Ethernet was another factor that made it easy to commit to this. With PoE, each Pi would only need one connection (a CAT-6 cable), and I wouldn’t have to deal with a pile of power adapters and tangled cords. Although I found several different PoE adapters available, I decided to play it safe and chose the Official Raspberry Pi PoE Hat and ordered a Netgear 16-Port PoE switch to power everything. Advertised as supporting 183W, and with the Raspberry Pi 4 spec recommending 15W per Pi 4, this seemed enough to support a dozen Pi 4s, though eight seemed like a good target for now.
Here’s the full parts list:
I didn’t order everything at once. I started with a couple of Pi 4s, then got the rack, mounts, PoE switch, and some patch cables, then a shelf for the switch and the MicroSD cards. Also, because I was wanting to order from Adafruit, I could only get one 8GB Pi 4 per order so I wound up getting a mix of 8GB (three), 4GB (two), and 2GB (one) Pis until I eventually broke down and ordered three 8GB Pi 4s from Newark, which had no per-order quantity limits.
Currently I have four Pi 4s in my rack with two on the way from Adafruit and 3 coming from Newark — I’ll probably drop the 2GB from the cluster when the others arrive and have six 8GB and two 4GB Pi 4s… though I’m curious to see if the memory differences noticeably affect performance of my nodes. I’m also still waiting for the PoE hats, so you’ll see power adapters in some of the early photos below.
Update (Feb 22): Five PoE hats arrived today and two more Pis. Here are some photos.
Update (March 6): I had a SmartiPi Touch 2 case and touchscreen that I’d ordered before I decided to build this cluster and a 1U spacer that I’d been thinking of using to mount my switch. Yesterday I spent Friday evening mounting the case to the spacer and my cluster got a head:
Unfortunately the screen only pivots down (and not back), but it’s still at a decent viewing angle. I tried flipping it to hang downward but didn’t have great results reconfiguring the Pi behind the touchscreen for upside down display — it’s a bit harder using Ubuntu instead of Raspbian, but the Kubernetes support on Ubuntu makes that worth it. I’ll post more on that later, but now my cluster is nine Pi 4s (six 8GB, two 4GB, one 2GB) and running smoothly.
Next: The Nodes and Network.