Kubernetes

Behind the Curtains: How My Multi-Node K3s Cluster is Setup

The tagline for my blog is “Always keep a spare for redundancy,” and nowhere is that philosophy more thoroughly tested—and relied upon—than in my homelab.

Earlier this year, I wrote about how I automate volume backups using Kyverno sidecars to protect my Longhorn persistent data. But storage backups are only one gear in the clockwork. Over the past couple of years, my homelab infrastructure has evolved from a collection of ad-hoc Docker containers and bespoke scripts into a fully declarative, multi-node K3s cluster managed strictly through GitOps.

Automating storage backups with Kyverno sidecars

In my homelab, I’ve been using Longhorn as my primary Kubernetes storage solution. It’s fantastic for high-availability block storage, but I still wanted a way to keep my data synchronized with my central NAS for long-term backups and to make it easier to recover from total cluster failures.

Initially, I was manually adding a pair of initContainers as sidecars to every single service YAML. This worked, but it was a maintenance nightmare—I had nearly 1,500 lines of redundant boilerplate across my repository.