Perspetivas

Why self-host on a Raspberry Pi cluster

Paulo Meireles2 min de leitura
Why self-host on a Raspberry Pi cluster

I run my services on a three-Raspberry Pi Kubernetes cluster. I explain the stack — k3s, Longhorn, Traefik, cert-manager — and why, for certain use cases, it's worth it compared to a public cloud.

Some people associate Kubernetes with large teams and data centers. The reality is that today you can run a production cluster on hardware that fits in the palm of your hand. My personal and professional services live on a three-Raspberry Pi cluster — and this article is, literally, served by it.

The hardware

Three Raspberry Pis (models 4 and 5), each with its own SSD via USB 3. They're connected to a switch on the home network, behind a router that port-forwards to the cluster. It's not a supercomputer, but it's more than enough for small and medium workloads: websites, CMSs, private registries, automations.

The stack: k3s

I use k3s, a lightweight Kubernetes distribution, packaged in a single binary and optimized for edge and IoT. It has everything I need from Kubernetes — pods, deployments, services, ingress, PVCs — without the weight of optional components. In three commands I have a node ready; a few minutes later, a three-node cluster with high availability on the control plane.

Storage: Longhorn

For persistent disks I use Longhorn, a distributed storage system native to Kubernetes. Each PVC is replicated across nodes, which means if one Pi dies, the data remains accessible on the other two. For a home cluster, this resilience is exactly what a "one server on a thumb drive" solution lacks. There are integrated snapshots, providing rollback and backup.

Ingress and TLS: Traefik + cert-manager

External traffic comes in through Traefik, which routes by hostname to the various services. HTTPS certificates are issued automatically by cert-manager via Let's Encrypt and renewed without intervention. Adding a new subdomain is just applying an IngressRoute and a Certificate — done, and in seconds I have valid HTTPS.

What runs on it

Right now the cluster serves: my website (Next.js), a Directus as a headless CMS, a Forgejo (private git and registry), a WordPress multisite for other projects, and several internal tools. Everything isolated in namespaces, with resource limits so no service chokes the others.

When it makes sense (and when it doesn't)

Self-hosting on a Pi doesn't replace the cloud for everything. It makes sense for personal services, low-traffic institutional websites, automations, and learning. It doesn't make sense for workloads with unpredictable spikes, critical latency, or when your upload bandwidth is the bottleneck.

Then there's the email factor: reliably self-hosting email from a residential IP is complicated because of reputation and reverse DNS. For email, a hosted solution (with your own domain) is usually the pragmatic choice.

Conclusion

What keeps me on this setup isn't the price (though it is low): it's the control. I know exactly where my data is, I configure every piece to my liking, and I learn a lot in the process. In a world where more and more things live on third-party servers, having a little corner of my own — redundant, secure, and mine — is a form of digital sovereignty.

Ler também