Skip to main content

K3s

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 | 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 -

and to uninstall it is:

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

Accessing my K3s cluster

To verify that everything was running properly I run:

sudo kubectl get nodes

Accessing my K3s cluster from my laptop

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

From my laptop I run:

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