Dino Fizzotti Showcases Kubernetes-Powered Clustering with Load Balancing on a Raspberry Pi Cluster

Looking to experiment without relying on a cloud provider, Fizzotti's build offers a lot of capability at very little cost.

Gareth Halfacree
10 days ago β€’ Hardware 101
Follow Fizzotti's guide to build your own low-cost highly-capable Kubernetes cluster. (πŸ“·: Dino Fizzotti)

Engineer Dino Fizzotti has written a guide to setting up a Kubernetes-based cluster using low-cost Raspberry Pi single-board computers, from initial provisioning with Ansible through to running a to-do application programming interface (API) β€” complete with monitoring and reporting.

Learning cluster computing concepts is a great way to add a seriously useful tool to your arsenal, and today the ready availability of low-cost single-board computers like the Raspberry Pi family means it's easier than ever. Earlier this year Canonical's Rhys Davies waxed lyrical on building Raspberry Pi clusters using the MicroK8s implementation of Kubernetes β€” and now Fizzotti is following in his footsteps.

"I decided to build a Raspberry Pi cluster to give me a platform with which I can practice distributed computing technologies without needing to rely on a cloud provider," Fizzotti writes of his project, which combines four Raspberry Pi 4 Model B 4GB single board computers with a cluster-focused Pi Rack case with an Anker PowerPort 5 charger, Netgear N600 gigabit router, and a selection of cables and microSD cards.

Unlike Davies' version, Fizzotti's cluster runs Raspbian Lite rather than Ubuntu Linux as its operating system β€” but uses many of the same core concepts. "I chose the popular combination of Prometheus for metrics collection and Grafana for dashboard visualization as my monitoring suite," Fizzotti writes. "To provide the Prometheus server with measurements I am using the popular node_exporter package, which makes a multitude of system resources available for metrics collection. Raspberry Pi CPU temperature measurements are supplied by another Prometheus exporter tool aptly named RPi exporter."

Installation and updating tasks are handled across the cluster with Ansible, while Kubernetes itself is provided using the k3s implementation β€” another shift from MicroK8s used in Canonical's guide. "k3s is a lightweight, certified Kubernetes distribution by Rancher Labs targeting Internet of Things (IoT) and edge computing," Fizzotti explains. "It provides all the core features and functionality that is required by Kubernetes, but has stripped out alpha features and certain storage drivers and swapped out the cluster etcd key-value store for a SQLite database. This results in the entire distribution being available as single 40 MB download (although some container images will be pulled during set-up), requiring just 512 MB of RAM to run."

Finally, Fizzotti adds a 240GB SSD in a USB 3.0 housing for high-speed storage, and then configures MetalLB as a load balancer and installs the target application - a to-do API, written in Go, as an example workload - via package manager Helm. Fizzotti then goes into various ways to "play with Kubernetes," including scaling the ReplicaSet and running the "Ellis-Hanselman Test" β€” literally pulling the network cable from the node currently being accessed.

Fizzotti's full write-up has been split into part one and part two on his personal blog.

Gareth Halfacree
Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.
Related articles
Sponsored articles
Related articles