Homelab Kubernetes: Getting started

Published by

on

I recently had the opportunity to re-purpose a good spec’d Desktop computer for a Homelab setup. Here’s a what the machine had spec wise –

  • AMD Ryzen 7900x 12 core CPU
  • 32 GB DDR5 6000 MT/s RAM in dual channel config
  • 1 TB NVMe Disk
  • Radeon 7900GRE 16 GB GPU

The requirements were to create a Homelab on which I could run Kubernetes along with a Desktop Environment as well. I also would like to use the GPU to run local LLMs using either AnythingLLM or ollama or something similar.

openSUSE Leap 16

I was very excited to hear about openSUSE Leap 16 release a few months back and had played with it in a VM. So I wanted to give it a try on metal. For Kubernetes, I had narrowed down to K3s from Rancher. Thus, openSUSE Leap 16 made logical sense as well. However, upto this point, I had not accounted for the AMD drivers for GPU.

So I went ahead and burned the openSUSE iso on a USB drive and booted into the installer. Up until now I have almost always used Ubuntu for most of my work and personal projects. So compared to installing Ubuntu, installing openSUSE was a very straight forward process; even without a working mouse!

Mouse or Keyboard without dedicate dongles don’t work during OS installations!

That’s because for such devices (without a dedicated dongle) the host OS maintains the bluetooth pairing and without the host OS, the chipset and the device can’t talk to each other. So, check before you attempt installing an OS with such a device. It’s the same problem you will have when you try and use such a device to make changes in your UEFI environment as well.

I chose the Gnome Desktop Environment along with enabling virtualization packages during the installation. Once I booted into openSUSE Leap 16, I updated the packages and installed K3s from their official URL here. Installing K3s is also a very straightforward process if you follow their quick setup instructions.

K3s

K3s is an all in one (single binary) fully compliant Kubernetes distribution. It’s great for newbies starting with Kubernetes and also for lighter workloads such as a Homelab or even hosting small clusters pointing to the internet. The defaults of K3s make it fairly secure and robust.

The only issue I ran into was that after installing it, if I tried to run

k3s kubectl version

I would get an error like

WARN[0000] Unable to read /etc/rancher/k3s/k3s.yaml, please start server with --write-kubeconfig-mode to modify kube config permissions 
error: error loading config file "/etc/rancher/k3s/k3s.yaml" : open /etc/rancher/k3s/k3s.yaml: permission denied

The simple fix for this is to copy the contents of k3s.yaml to a user writable directory. So i fixed it with the following steps

mkdir ~/.kube
export KUBECONFIG=~/.kube/config
sudo /usr/local/bin/k3s kubectl config view --raw > "$KUBECONFIG"
chmod 600 "$KUBECONFIG"

Once done, I now get a proper output for k3s kubectl version. Pay attention to adding the full path to k3s in the step above.

For doing this on every terminal and also not requiring to type kubectl all the time add the following to your .bashrc file.

export KUBECONFIG=~/.kube/config
alias kc=kubectl

Now you can verify the status K3s with sudo service k3s status

Let’s now install a GUI to see and manage the K3s kubernetes cluster.

Lens K8s IDE

A simple GUI to view and manage your kubernetes cluster is the Lens K8s IDE. You can download it as an AppImage and run it directly without installing it on your machine. Once you start it, you will be required to create a free account on their main website. Lens is free for personal use as of writing this post.

Screenshot of the Lens K8s IDE home page, displaying options for account settings, software information, and download buttons.

Once you have the Lens IDE account registered, the IDE will start and you should be able to see your local Kubernetes cluster.

Screenshot of the Lens K8s IDE showing the cluster overview with CPU, memory, and pods usage statistics.

Great! Now we have a working K8s cluster! Let’s look into the AMD GPU drivers in a following post.

Leave a Reply

Discover more from EZEETECH AI

Subscribe now to keep reading and get access to the full archive.

Continue reading