Tsunati University - Register Today

MicroK8s and OpenEBS

MicroK8s is a Kubernetes distribution from Canonical. It runs on Ubuntu and is advertised as a lightweight Kubernetes distribution, offering high availability and automatic updates. Today I going to setup a single node MicroK8s cluster and leverage OpenEBS storage for dynamic allocation. You can choose to install MicroK8S during the OS Ubuntu as one of the extra packages install options or simply run the snap command on an existing system:

The command from the cli:

sudo snap install microk8s –classic

MicroK8S comes with kubectl baked in but by default it is in this form microK8S.kubectl. When I first run it I get some instructions about my permissions:

I will run both commands and try again

sudo usermod -a -G microk8s $USER 

sudo chown -f -R $USER~/.kube

After running newgrp microk8s I can see my node

Typing microk8s.kubectl is going to be a nuisance so I will create and alias in my .bashrc file

Then you can either logout login again or run exec bash Now I should be able to use kubectl:

Now that my microK8S install is running I can check the status which among other things will show me what addons are available. microk8s status

I am going to enable the following addons for my setup: microk8s enable rbac dns openebs storage metallb

I will need to provide a pool of IP addresses for my Metallb

By default microK8S comes with its own hostpath storageclass

However I want to use OpenEBS ZFS since that also has volumesnapshots that can be leveraged by Kasten by Veeam. I need to install zfsutils beforehand. sudo apt install zfsutils-linux I will also need to enable iscsid in Ubuntu sudo systemctl enable iscsid

I am going use OpenEBS’s zfs operator and will apply the manifest direct from their github repository kubectl apply -f

Next I need to create a new storageclass. Later on I will create a poolname called zfspool1 and it is included in the class manifest in the second to last line.

We want to make our openebs-zfspv storageclass the default storage class with these two commands:

Next I want to create a new ZFS snapshotclass for Openebs using the zfs csi openebs driver. vi snapclass.yaml

Before I can start using this storage I need to create a ZFS storage pool I have 2 drives that I want to use /dev/sdb and /dev/sdc sudo fdisk -l

I will now create a simple nginx pod with a persistent volume claim that should be automatically allocated storage from my zfspool. I am going to create an nginx namespace and deploy the pod with pvc there:

kubectl create ns nginx

Next I will deploy an nginx pod with a pvc requesting storage with this manifest:

Great I have a pod running with storage on openebs-zfs

One of the Veeam Engineers in Belgium Timothy Dewin has great github repo with a Ubuntu Kasten lab creation script that helped me when setting this up. He also has some other great content there so I highly recommend everyone takes a look:

So what is next? You guessed it, next time we will get Kasten going on this cluster and see if snapshot our nginx pod and pvc on the OpenEBS ZFS storage.

Scroll to Top