Two weeks ago I wanted to play around with Kubernetes for a day or two. I found this training course internally at VMware that allowed me to go through some labs. I asked around if anyone had some tips on getting Kubernetes up and running fast. I couldn’t be bothered with creating a multi node kubernetes cluster. I wanted to play around with some of the commands and YAML files. I tried Atomic as suggested by the lab manual, but there were way too many steps involved to install/configure Kubernetes if you ask me. Next option would be some version hosted in a cloud of choice, but I didn’t want to incur the cost. After digging around I stumbled on MicroK8s. It sounded easy, so I figured I would give it a try. When it comes to Linux my preference is Ubuntu/Debian, it is just what I am most familiar with, and as MicroK8s comes from Canonical I figured I would give it a try. As Kelsey Hightower suggested on twitter yesterday (which triggered this article), it is just one command away:
I think @Canonical might have assembled the easiest way to provision a single node Kubernetes cluster:
$ snap install microk8s –classichttps://t.co/Px9UZVrv01
— Kelsey Hightower (@kelseyhightower) April 23, 2019
I downloaded the latest Ubuntu Server ISO and I created a VMware Fusion VM. I stepped through the installation wizard of Ubuntu Server and then noticed it already provided the option even to install “microk8s”, I selected the package, and some additional packages I figured I would need, and clicked done. Literally within minutes, I had a fresh single node Kubernetes configuration, which for me worked straight out of the box!
After it is done configuring, click reboot and login. I created an alias for kubectl, as I didn’t want to type “
microk8s.kubectl” every time or install a different version:
sudo snap alias microk8s.kubectl kubectl
I also enabled the Kubernetes dashboard from the get-go, which can be done by running the command “
microk8s.enable dashboard“. There are a whole bunch of articles out there that can take you through the steps of deploying your first container, making it highly available by specifying the number of instances so I am not going to do that. I don’t want to pretend to be an expert, as I am far from that. Also, check the MicroK8s documentation, it is pretty decent. My colleague Myles Gray has a very good tutorial on why containers, very good read which I also recommend for people who just want to know a bit more about it like myself.