Home Lab Setup — Part 1

Jake Peterson
2 min readJul 17, 2022

About two years ago I decided to setup a Homelab on an old gaming pc. Recently my homelab server crashed and I had to start rebuilding it from scratch so I felt this was a good opportunity to document how I set everything up.

I will be using Microk8s for my home lab kubernetes cluster. Microk8s is well suited for my single node homelab that I use to host my personal portfolio webpage, various learning projects, home automation software and my CI/CD pipline because it is simple to setup and uses a relatively low amount of resources.

Hardware and OS

I will be running my homelab on an old gaming computer will a Intel Core i7–6700K, 16 GB DDR 4, and a 1 TB SSD. For the OS ill be using Ubuntu 20.04

Microk8s

With the server hardware and OS setup its time to install Microk8s.

First ill install Microk8s with snap

sudo snap install microk8s --classic --channel=1.24

Next ill setup user permissions

sudo usermod -a -G microk8s $USER
sudo chown -f -R $USER ~/.kube

Next I’m going to enable some of the built in microk8s addons

microk8s enable dns hostpath-storage ingress helm3

Once everything is finished installing, ill check the status of the resources in the cluster and make sure that all the pods have stabilized

microk8s kubectl get all --all-namespaces

I’m going to check for any additional configuration that might need to be done by running

microk8s inspect

In my case the inspect command noted that

IPtables FORWARD policy is DROP. Consider enabling traffic forwarding with: sudo iptables -P FORWARD ACCEPT
The change can be made persistent with: sudo apt-get install iptables-persistent

and that I should make sure I have a docker config file. I followed the instructions provided to fix both of those issues.

Reference: https://microk8s.io/docs/getting-started

Finally I don’t want to use microk8s built in kubectl command so I’m going to use snap to install kubectl and then im going to configure it.

snap install kubectl --classic
kubectl version --client

Now that kubectl is installed I need to configure it to connect to my Microk8s cluster.

First ill navigate to

cd ~/.kube

If you don’t have this folder you should create it. Once there you will want to create a kubeconfig file. There isa lot more to configuring kubectl access to clusters especially if you need to access more than one cluster but for the sake of this setup I am just going to be connecting to the Microk8s cluster. Ill run the following command to generate a config file based on my microk8s cluster

microk8s config > config

I should now be able to use kubectl to look at the resources on my microk8s cluster

kubectl get all --all-namespaces

Reference: https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/

In the next part of this series Ill begin to configure some of the other resources I’m going to need to run my homelab such as cert-manager and the ingress controller.

--

--