A photo of several Raspberry Pi 4 computers with ethernet plugged in and USB C power plugged in.
Raspberry Pi 4 GIS Cluster
February 12, 2021

I have been getting excited with the recent developments in the Raspberry Pi realm, the ARM processor ecosystem, and the magic of containerization, particularly from the Ansible and Kubernetes developer Jeff Geerling. He has had several video series on building and working with Raspberry Pi clusters, Kubernetes based containerization, and the management software Ansible. Over the past several months I have been working part time remotely while waiting for my residence permit in the Netherlands, and so I decided to make my own Raspberry Pi 4 based clusters of machines, and learning Kubernetes and Ansible in the process, and I am going to run all kinds of GIS software in containers on the cluster.

The Hardware

A top down photo of a Raspberry Pi 4 in a stackable Pi case.

I have had a Raspberry Pi 4 8gb since it was announced, and I have been using it as a little lightweight desktop for when I just want to browse the web. The 8gb Pi 4 will be designated as the Kubernetes cluster controller. I recently purchased four Raspberry Pi 4 4gb boards, and they will be the Kubernetes nodes. I have them set up in an expandable stacking open air case, and each Pi has a heatsink on each CPU. For networking, I have a basic unmanaged eight port gigabit switch from Netgear, and for power I am using a 6 port USB power supply.

A photo of Cat5e Ethernet cables plugged into a switch, link lights on the ethernet ports are illuminated.

Each Pi has a 16gb microSD card that the operating system is installed on, and the 8gb Pi has a 64gb USB drive. Each pi will have the 64gb drive added as a network drive and will store data on that device.

The Software

For the operating system I am going with my most comfortable platform, Ubuntu. I use Ubuntu desktop all the time on my laptop and second operating system on my desktop, I regularly use Ubuntu in Windows with Windows Subsystems for Linux, and I have built many a web server with Ubuntu server, this website being one of them. Naturally it is my most comfortable platform.

For the flavor of Kubernetes, I am deploying K3s because I have found many tutorials and resources using K3s, and from what I have gathered it is a lighter weight compute platform over Canonical’s MicroK8s.

To deploy Kubernetes I am using Ansible, Rancher, the creator of K3s provides an Ansible playbook for deploying and configuring K3s properly. I am also creating my own Ansible playbook to update the machine names from the stock “ubuntu” network name, and to connect each pi to the 64gb network drive on the 8gb Pi.

The Containers

The first basic GIS container configuration

I have a long list of containers that I want to deploy, but I also have a specific ecosystem configuration in mind. I am going to deploy a PostgreSQL with PostGIS container, a GeoServer container that will use the PostgreSQL database, as well as create a website with an nginx website with a leaflet webpage that consumes OGC web services from GeoServer. I will also connect to the PostgreSQL database from my desktop in QGIS Desktop and DBeaver.