Wanna run Kubernetes at home? Here's an easy way to do that.

What is openSUSE Kubic?

openSUSE Kubic is a community Linux distribution intended for running server side containers.

It's also a Kubernetes conformant distribution.

OS architecture

openSUSE Kubic is read-only transaction OS, similar to Fedora Silverblue and Fedora CoreOS.

This distribution supports atomic rollbacks and separates user-data and container data out to /var, which is in it's own partition.

The supported container runtimes are cri-o and Podman. Docker is unsupported, but compatible with the commands of Podman.

Installation

Let's install the OS.

Grub boot menu:

kubic-grub

Choose 'kubeadm node' the option in the System Role part of the installer:

kubic-install-system-role

Begin the installation:

kubic-confirm-install

Login into the system:

kubic-booted

Initialize Kubernetes on the host

Ensure that the Pod network CIDR is set for the Flannel Container Network Interface (CNI).

kubeadm init --pod-network-cidr=10.244.0.0/16

Initialize Kubernetes on the node with kubeadm:

kubic-kubeadm-init

DNS issues

If you had DNS issues on throughout the installation, you will need to unfortunately configure the network's default gateway. Go to /etc/sysconfig/network/routes and add the line:

default 192.168.1.1 - enp0s25

(Replacing enp0s25 with the name of your interface, and replacing 192.168.1.1 with the default gateway of your network)

Preliminary setup

Now that Kubernetes has been initialized on the node, you'll need to add the kubeconfig to your home folder so you can talk to the Kubernetes API.

mkdir -p $HOME/.kube
cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
chown $(id -u):$(id -g) $HOME/.kube/config

Test that you can talk to the API

The following command will return status information if all is well

kubectl cluster-info
kubic-kubectl-cluster-info

Setting things up

Allow Pods to run on the master The following command removes the limitation of running Pods on the master node.

kubectl taint nodes --all node-role.kubernetes.io/master-

Install a Network Overlay

For this setup we'll be using the Flannel CNI. Flannel is a simple Container Network Interface which allows service to talk to each other. For a more advanced CNI which provides PodNetworkPolicies check out Calico.

kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

Verifying the setup

The following command will output all Pods in all namespaces.

kubectl get pods -A
kubic-kubectl-get-pods

Final thoughts

I've found openSUSE Kubic to be one of the easiest methods for bringing up a Kubernetes cluster inside a VM or on real hardware that is also specifically designed for containers. I've been running it at home for almost a month and it seems to be generally stable (just make sure that you have at least 6GB of RAM for system stability).