How to Set Up a Raspberry Pi Cluster

Posted on Wednesday, August 26, 2020

Photo by Jonathan on Unsplash

The full text of this article can be found on Medium.

This article covers what you need to know to setup your own Raspberry Pi cluster, including you what you need to buy, how to install the OS and configure the Raspberry Pis, how to set up networking, and other things you need to know to sinplify ongoing administration and maintenance of the cluster.

This is the second article of the series described in Develop and Deploy Kubernetes Applications on a Raspberry Pi Cluster. After completing the steps outlined in this article, you’ll be ready to learn How to Install Kubernetes on a Raspberry Pi Cluster, the next article in the series. As this article references a couple of other articles relevant to the task, you might find it helpful to have them open in another browser window so you can cross-reference between them and this one as needed. There are five main sections to this article:

  1. My Target Cluster Topology - This section describes what we’ll build in this article.
  2. Initial Setup - This section describes what equipment is needed, how to install the OS, and how to complete the initial configuration of each Raspberry Pi.
  3. Configure the Network - This section describes the process to follow to configure the actual Raspberry Pi cluster. At the end of the section, we’ll have a working cluster.
  4. Set Up Keyless SSH Access Between Hosts- This section will cover how to configure key-less ssh access between the nodes of the cluster. It will also describe how to set up a reverse-ssh tunnel to a host in the external network to allow any permitted host in the external network ssh access into any of the permitting cluster nodes. This isn’t possible out of the box because the Pi router won’t forward IP traffic from the external network into the cluster network.
  5. Set Up i2cssh- This section covers how to have simultaneous terminal sessions open to several hosts. i2cssh is a terminal multiplexer similar to tmux. With i2cssh, you can have commands replicated to every terminal session. This is useful if you want to execute the same commands on multiple hosts at the same time.

Articles in the Series

The full set of articles are:

  • Set up a Raspberry Pi Cluster : Describes how to set up and configure a group of Raspberry Pis into a cluster. This includes defining the networking within the cluster and to an external network.
  • Install Kubernetes on a Raspberry Pi Cluster: This includes installing & configuring Kubernetes as well as building and deploying a simple service. This latter step involves a minimal application that can be used to test the Kubernetes cluster as well as simple external network access to the application.
  • Install Kubernetes Ingress on a Raspberry Pi Cluster: Ingress is a useful way to support external access to services inside the cluster. In this article I’ll be describe how to install, configure, and test Traefik as an Ingress Controller. This article also includes installing and configuring Helm. Helm will be used to deploy Traefik. Helm will also be used in later articles in the series.
  • Kubernetes Application Monitoring on a Raspberry Pi Cluster — Install Prometheus, Grafana, and an EFK (Elasticsearch/Fluentd/Kibana) as a monitoring stack. It also covers installing Telegraf on the cluster to monitor machine level metrics for hosts on the cluster. E.g., CPU load and temperature, disk usage
  • How to Install MariaDB on a Raspberry Pi — The title says it all. One thing to note, MariaDB is a drop-in replacement for MySQL