# Setting up my homelab

Building a homelab on microk8s after deciding to migrate Fenerum to Kubernetes — what I learned, what surprised me, and how to set it up yourself.

Published: 2024-03-08
Source: https://www.kristian.io/blog/2024/03/homelab/

After deciding to migrate to Kubernetes at Fenerum, I wanted to set up a homelab to play around in a safe environment and at the same time take the opportunity to
start hosting various services myself.

For a long time I though setting up Kubernetes required a PhD and 30 hours a week, but it turns out it is very easy to install and manage yourself. I decided on using microk8s
offered by Canonical as it appeared to be extremely simple to set up and achieve a higly available (HA) setup.

For my homelab I wanted to around with failover and not be afraid to lose a node. For the same reason I decided to buy three used computers. I found three cheap Lenovo Tiny's
with a 3Ghz i3 processer, 128 gb SSD and 16 GB ram. I got them all for less then 300 EUR incl shipping.

I simply flashed ubuntu server minimal to a USB flashdrive and plugged it in to each of them while connected to a screen + keyboard and completed the wizard and then
continued with the tutorial found here: https://microk8s.io/#install-microk8s

A few minutes later, I had a HA three-node microk8s cluster. I then went on to deploy my website (the one you are currently reading) to my cluster and then a few other static
sites.

I use Caddy as a load balancer for websites, so I only expose port 80 and 443 to the world and all inbound traffic will go through Caddy. It works great and also handles SSL
automatically via LetsEncrypt.

I decided on using MetalLB to expose the services from k8s to my local k8s VLAN. From there I used my unifi router to redirect inbound traffic.

Very quickly I found out that it is rather annoying to manually update the kubernetes manifests every time I change soemthing so I wanted to set up auto deployments from
GitHub. I found a really cool software called [keel.sh](https://keel.sh) that integrates with Github Container Registry (GCR) and set up builds via GitHub Actions to GCR. Keel
listens for new releases and then deploys them. Very nice.

That's it. Welcome to my re-launched website hosted on microk8s brought to you from my new homelab, located in a rack in our closet :-)
