Skip to main content

· 3 min read
Kas J

So with my hardware set up, it was time to get my software up and running. One of the main objectives of setting up this homelab was to get familiar with kubernetes so we need to get a cluster up and running so I can do more than this:

dilbert

Installing an OS

I needed to get an OS installed on my NUC before anything else. There are plenty of open source options out there but I stuck with trusty Ubuntu Server 22.04.1 LTS

K8s vs K3s

Before I got stuck into deploying my kubernetes I wanted to investigate what options I had for a homelab. It boiled down to two main ones: K8s vs K3s. Both K8s and K3s share the same source code but the key difference for me was that K3s was significantly more lightweight, can be deployed much faster and still all all the key capabilities of K8s. There are a number of "production grade" features that are excluded from K3s such has handling of complex applications and intergrations with public cloud providers which I didn't require.

Installing K3s

Installing K3s couldn't be more easier out of the box and it takes no time at all. I simply needed to ssh into my freshly install ubuntu server and execute the following command:

curl -sfL https://get.k3s.io | sh - 

and to uninstall it is:

/usr/local/bin/k3s-uninstall.sh

I must admit I ran these commands ALOT because there were a number of things that were installed by default which I didn't need (yet). I'm not going to get into the various customisable configuration options here but there is some pretty good documentation for it. After tweaking my configuration, I ended up with the following command to install the cluster I wanted:

curl -sfL https://get.k3s.io | K3S_KUBECONFIG_MODE="644" INSTALL_K3S_EXEC="--disable traefik --disable servicelb --disable kube-proxy --disable local-storage --cluster-init --tls-san 10.43.0.1" sh -s -

Accessing my K3s cluster

Ok time to run my first kubectl command. To verify that everything was running properly I run:

sudo kubectl get nodes

which shows me my single node in my cluster is up and running:

getnodes

I needed to run it in sudo which I thought was annoying -I had to fix this (OCD much?). The K3s kubeconfig file is stored at a rancher location /etc/rancher/k3s. I think this is why I needed to run kubectl in sudo. So I ran the following steps to rectify that:

Create .kube directory in my home directory

sudo mkdir /home/kas/.kube

Copy the kubeconfig file into the newly created directory

sudo cp /etc/rancher/k3s/k3s.yaml /home/kas/.kube/config

Change ownership of the directory so that root wasn't needed

sudo chown kas:kas /home/kas/.kube/config

Let K3s know the location of the new config file (and hopefully the last time I have to use sudo for kubectl)

sudo kubectl config set-cluster default --server=https://192.168.86.41:6443 --kubeconfig /home/kas/.kube/config

I wanted to ensure I could access my cluster from my laptop without having to SSH into my ubuntu server (k3smaster) everytime. To do this I needed copy the kubeconfig file across to my laptop using scp:

From my laptop I run:

scp k3smaster:/home/kas/.kube/config /home/kas/.kube/config

...and I'm laughing::

getnodes

· 2 min read
Kas J

I've normally resorted to buying raspberry pi's (I now have a Model 2B, 3B and 4) and don't have any major self-hosting requirements so I considered clustering them together. Given the current ARM architecture limitations on the older models, I decided I will bite the bullet and buy some more dedicated hardware. I also figured I could:

  • Add the raspberry pi's into the cluster for some more resources if need be at a later date.
  • Use the raspberry pi's as an isolated sandbox for testing

With Raspberry Pi 4's currently in low stocks, I started exploring mini PCs/NUCs. They are actually pretty cool, the specs are much better, the costs aren't that much higher and they are built to last.

I ended up getting Intel NUC 11 Essential Kit Celeron N4505 (Atlas Canyon) which was on special at CentreCom. I unboxed and plugged it in immediately only to realise that it is pretty barebones unfortunately.

NUC

The site doesn't cover it but it doesn't come with any pre-installed HDD or RAM (that's why it was cheap!) so I needed to get those off Amazon. Here's what I bought:

2 X 8GB DDR4 RAM

RAM

1 x 500GB SSD Hard Drive

HDD

Installing them were pretty easy - plug n play, I was then ready to rock n roll!

· One min read
Kas J

So first things first, just like a chef needs to keep their bench clean, think this is the perfect time to clean up my office table. More importantly this cable situation that has been driving me INSANE

Untidy Cables

Cable Management

I've had a couple of attempts at cable management but it has always been half-arsed and heavy on the duct tape. It was time to do this properly. I bought a couple of cable cradles from Amazon that fit nicely under the table. From there it was relativey easy to run all the cables and extension cords through. Here's the final result:

Tidy Cables 1 Tidy Cables 2 Tidy Cables 3

· One min read
Kas J

I've been dabbling with a few self hosted services on my laptop or a raspberry pi for a while now but I now have a need to run some of these services on going. I've also wanted to become more comfortable with kubernetes administration so this is also a great opportunity for me to learn something but also run a few practical services at home.

There are some amazing resources available that I have been leaning on heavily but I find writing things down will help make some of the key concepts stick. I'm hoping I can then transfer some of these skills to my work and future projects.

I wanted to give a shout out to technotim and noted.lol who I've drawn a lot of inspiration from for a number of my services.

Full disclosure, I'm not one to write blogs so this is a bit of a challenge in itself. I've given myself a bit of license to be a keep things a bit rough as I write to keep myself motivated to continue to post regularly.

If you're interested feel free to read through my posts and head over to my docs