Edge / IoT / Kubernetes / Tools / Sponsored / Contributed

Creating a Demo Environment with a Raspberry Pi Cluster

22 Nov 2021 10:00am, by

Charles Mahler
Charles is a technical marketing writer at InfluxData. Charles’ background includes working in digital marketing and full-stack software development.

In today’s world, the default application hosting choice is to just spin something up in the cloud. Sometimes, though, alternative options work better.

A little over a year ago, the InfluxData marketing team wanted to set up a demo environment with Kubernetes. The plan was to use it for benchmarking, generating demo data and being able to test out any other random ideas we might have.

Using any of the available managed Kubernetes services was the obvious solution, but this seemed like overkill for what we needed. We weren’t planning to use this for production and wouldn’t be using it very often, so it didn’t really make sense to pay for 24/7 availability with a huge amount of resources. Using the cluster for resource-intensive tasks would be a rare occasion.

After considering some alternatives, we decided to go with a Raspberry Pi cluster. This gave us flexibility, and as a bonus, the only long-term cost is the small amount of electricity the cluster uses while running in the office.

Raspberry Pi Cluster Alternatives

Once we decided against a cloud-hosted Kubernetes environment, there were still a few alternatives to consider. One option would have been to create a more conventional x86 server cluster, but that was also overkill.

Another alternative that wasn’t available at the time was TuringPi, which uses Raspberry Pi compute modules rather than Raspberry Pi 4. To make things easier, we went with a kit from Pico Cluster that included all of the components we would need. All we had to do was assemble it.

​​Boxes of Raspberry Pi components

In the end, we chose Raspberry Pi over some other cheaper alternatives primarily because of the huge community and the amount of available tutorials and other community resources.

Hardware Breakdown

Now let’s get to the exciting stuff, the type of hardware we are actually working with!

Raspberry Pi components

Our Raspberry Pi cluster runs the following hardware:

  • 5 Raspberry Pi 4B with 8GB RAM and Quad-core Broadcom 1.5GHz CPU
  • 5 Samsung 860EVO V-NAND SSD SATA M.2 + SATA M2 250GB
  • 5 Kingston 64GB microSDXC Canvas Go Plus 170R A2 U3 V30

The cluster uses a 1GB-per-second local network with a dedicated router. Each Raspberry Pi acts as a node in the Kubernetes cluster with a static IP address that uses MetalLB as the load balancer. The CPUs have been overclocked to 2.0GHz to get more performance.

Raspberry Pi components plugged together

Software Breakdown

Dashboard screenshot

Ubuntu 20.04 is used as the operating system for this Raspberry Pi cluster. Applications are run inside Docker with Kubernetes orchestrating the containers. We use Jenkins for automating jobs, which run in Kubernetes and InfluxDB, with Telegraf for monitoring all the demo data and other things running on the cluster. Ceph is used for storage.

This setup works well and can be used when we test out integrations and develop templates for some of the most popular software that can be used with InfluxDB.

Cluster monitoring dashboard

Use Cases for a Raspberry Pi Cluster

For our use case at InfluxData, our Raspberry Pi cluster works perfectly. Although, you can also do much more than just run a Kubernetes cluster for work-related stuff. Below are a few ideas from our team about how you could use your own personal Raspberry Pi cluster.

Home Automation

One cool way you could use your Raspberry Pi cluster is to manage and automate some of the stuff in your home while maintaining your privacy. Home Assistant is an open source platform for home automation that integrates with over 1000 different devices like Amazon Alexa, Google Assistant, Phillips lighting, Plex server and protocols like MQTT. It is built to be customized and extended for your use case.

Some common use cases would be sending notifications from cameras, creating wake-up alarms with your lights, minimizing energy usage based on certain factors and much more.

It should be noted that you can probably accomplish most home automation tasks with a single Raspberry Pi in terms of computing power, but a cluster could be useful for redundancy.

Raspberry Pi Supercomputer

While our cluster only has five connected Raspberry Pis and is a long way from being considered a supercomputer, you could take things to the next level if you wanted. Oracle, for example, had a team of salespeople create a 12-node Raspberry Pi cluster as a demo environment for Oracle Cloud. Over time, Oracle expanded the project until it was a 1060-node cluster.

Learning

Building out a Raspberry Pi cluster is also just a great way to learn about a ton of different things that can be useful in a technology job. In the process, you’ll learn about networking, IT and many other things. Once you have it set up, you have the perfect environment for learning about DevOps and anything else you want to try without having to worry about destroying something important while playing around.

Lessons Learned

Setting up and running the Raspberry Pi cluster was fun for our team and accomplishes exactly what we set out to do from a business perspective. That isn’t to say it was all sunshine and rainbows; there are a few things you’ll want to watch out for.

First off, many tutorials you’ll find online will only cover some very general use cases, so you will have to handle edge cases as you go. One struggle for our team, because we chose Ubuntu ARM64 as the base operating system instead of Raspbian, many Docker images didn’t work correctly when trying to run critical components. (This has gotten better over time as many more projects are beginning to support ARM64.)

Another major limitation is anything that involves a lot of network communication (not having a strong connection at your office or home being the most obvious problem). You could also run into issues with latency if you are trying to communicate with systems that are running in the cloud. For anything involving IoT, monitoring or small R&D use cases, though, a Raspberry Pi cluster is a great solution.

Demo cluster with lights

The New Stack is a wholly owned subsidiary of Insight Partners, an investor in the following companies mentioned in this article: Docker.

Featured image via Pixabay