Wojtek @suda Siudzinski

Python/Node/Golang developer, DIY hacker, rookie designer, 3D print junkie. Owner @ Appsome, CEO @ Gaia Green Tech

5-minute home server with microk8s and Rancher

Updated on Jan 10, 2021 to use Helm 3.

After getting tired with instability of my QNAP TS-251B (random reboots once a day, official apps not working) I decided to turn my Intel NUC into a home server. I could've used a Raspberry Pi, but I do need a x86 for most of the Docker images I use. I decided to use Kubernetes, which for many might come off as a huge overkill (and possibly it is) but that's what I'm interacting with in my professional life thus it's easier for me to do what I need in a familiar environment :)

I looked through single node Kubernetes installation options, I found microk8s which Kelsey Hightower called "the easiest way to provision a single node Kubernetes cluster". Oh boy was he right! Ubuntu Server comes with an option to install microk8s making it practically zero effort installation!

Second part for me was to add some GUI to manage. I choose Rancher as it has a great integration with both Kubernetes and kops.


First start with a fresh installation of Ubuntu Server. I used 18.04 LTS but feel free to use latest version. To make a bootable USB drive with the image, you can use Balena Etcher. Once you have it installed on your machine, ssh into it and issue following commands:

# Install microk8s from the 1.19 channel (Rancher doesn't support Kubernetes 1.20 yet)
$ sudo snap install microk8s --classic --channel=1.19
# Enable useful plugins
$ sudo microk8s.enable dns dashboard storage ingress helm3

# Allow running priviledged Pods (required by Rancher's `cattle-node-agent`)
$ sudo sh -c 'echo "--allow-privileged=true" >> /var/snap/microk8s/current/args/kube-apiserver'
$ sudo systemctl restart snap.microk8s.daemon-apiserver.service

# Install cert-manager user by Rancher
$ sudo microk8s.helm3 repo add jetstack https://charts.jetstack.io
$ sudo microk8s.kubectl apply -f https://raw.githubusercontent.com/jetstack/cert-manager/release-0.9/deploy/manifests/00-crds.yaml
$ sudo microk8s.kubectl create namespace cert-manager
$ sudo microk8s.kubectl label namespace cert-manager certmanager.k8s.io/disable-validation=true
$ sudo microk8s.helm3 install --name cert-manager --namespace cert-manager --version v0.9.1 jetstack/cert-manager

# Install stable Rancher
$ sudo microk8s.kubectl create namespace cattle-system
$ sudo microk8s.kubectl label namespace cattle-system cattle-system.k8s.io/disable-validation=true
$ sudo microk8s.helm3 repo add rancher-latest https://releases.rancher.com/server-charts/latest
$ sudo microk8s.helm3 repo update
$ sudo microk8s.helm3 install rancher rancher-latest/rancher --namespace cattle-system  --set replicas=1 --set hostname=${HOSTNAME}.home

Now you should be able to see Rancher interface at https://SERVER_IP! There are two manual tasks you need to do on your machine:

  • the SSL certificate will be marked as invalid so you'll need to add it to trusted certificates
  • Rancher is installed with a ${HOSTNAME}.home hostname which you need to add to your /etc/hosts file (.local domain can't be used with Rancher)

Hope this worked and let me know if you have any comments!

Thanks to Harald Löbig for helping with the Helm 3 update!

P.S: If you're using Raspberry Pi, the Rancher folk created k3s which is a single node Kubernetes installation that requires <512MB of RAM!

comments powered by Disqus