Get a Minecraft Server and Metric Reporting Up on Your Raspberry Pi Cluster
With a 15-minute Raspberry Pi Kubernetes cluster at his disposal, Max Gabrielsson set up a Minecraft server — with full metric reporting.
Separated from his co-workers, Max Gabrielsson decided to join them in the virtual world of Minecraft — but to run the server on a cluster of Raspberry Pi single-board computers, courtesy of Kubernetes, Helm, and Prometheus.
"Ever wanted to put your Raspberry Pi cluster to great use? Our team is working remotely, so we started to play Minecraft. I decided I would host the Minecraft server on my Raspberry Pi cluster," writes Gabrielsson. "Why? Quoniam Possumus — because we can."
In his step-by-step guide, Gabrielsson walks through the steps required to install Minecraft server on a Kubernetes cluster — though not the setup of the cluster itself, linking instead to a 15-minute tutorial written by Alex Ellis earlier this year — using Helm, a Kubernetes management system based on scripts dubbed "charts." Using a pre-written Helm chart for Minecraft server, it's a simple process - but one somewhat complicated by Gabrielsson's desire to include metric
The metrics reporting is handled by a plugin for Minecraft which exports data to Prometheus Operator. The result: A dashboard which contains information ranging from live and historical player counts to the number of entities in Minecraft's three worlds — the overworld, the Nether, and the End — and the amount of memory consumed by the Java virtual machine (JVM).
Gabrielsson also offers a few non-obvious tips specific to this particular setup: "To give the node where Minecraft is running access to the whole CPU and RAM," he notes, "you'll need to taint it so it only tolerates the Minecraft server. [Also], if you are using Raspberry Pi 4, consider using a 64 bit kernel to utilize more than 2 GB memory per process."
Gabrielsson's full guide can be found in this GitHub Gist.