Okay, you started learning kubernetes; maybe you are following some courses or documentations. Some of the courses are arranged with FREE labs where you can do hands-on labs and test your knowledge. And you can also use the FREE labs around, like kubernetes labs in katacoda.com. That’s more than enough, but what if you want to test more on kubernetes clusters other than lab arrangements ?
Find FREE OpenShift Hands on Labs here.
Sometimes, you have situations like you need to test the latest kubernetes version or kubectl version and those FREE labs are not yet ready with those versions. So what, you can easily set up your own kubernetes cluster on your laptop or workstation. But, setting up a full kubernetes cluster is not required in most cases as we have a minimal version of kubernetes called minikube.
Minikube is a tool to run a kubernetes cluster locally, that means on your laptop or inside a virtual machine. Minikube will run a single node kubernetes cluster on your machine with almost all features you want to try on an actual kubernetes cluster; like DNS, NodePorts,ConfigMaps and Secrets, then kubernetes Dashboard, Container Runtime like Docker, CRI-O, and containerd, and also enabling CNI or Container Network Interface, ingress, yes almost all items you need your hands get dirty.
Not really and depends on your experience with virtual machines or docker configurations. If you check the minikube installation document, you will find very few steps but it’s not actually.
You can spin up a minikube cluster inside a virtual machine like virtualbox, hyperkit, hyperv, vmware or kvm. Or you can install minikube directly on a physical machine like your laptop or workstation, using
--driver=none. But that needs docker to be installed on that machine as kubernetes components will run as docker containers.
Let’s say, we need to spin up a minikube cluster whenever we need, quickly and without any hurdles, then we can mix up some of the solutions and implement this minikube as Infrastructure as Code or IaC. We will use vagrant to provision the virtual machine, then we will use Ansible as a provisioner and install all those required packages. For this demo, we will use VirtualBox as a hypervisor, but you may try with any other hypervisor or public cloud solutions.
Vagrant is one of the easiest tools to provision infrastructure or virtual machines in a single workflow and this is available for Windows, MacOS, Linux, Debian, Centos etc.
Ansible is super simple and powerful in terms of its usage. Once you start using Ansible, you will realize that this is simpler than shell script. Please note, Ansible is not natively available for Windows yet and you might need some extra setup like cygwin to achieve this in a windows environment. Later I will share the shell script version of the same but for this demo we will use Vagrant + Ansible.
We will not go in details as our focus is on minikube cluster setup. But just to add, you have several reasons to implement IaC.
In this video, I will explain how to create a minikube cluster very quickly with the help of vagrant and Ansible, that means you will not be required to run a lot of configurations to start the cluster.
Questions ? Please ask in comment box and I will try my best to
Disclaimer: The views expressed and the content shared are those of the author and do not reflect the views of the author’s employer or techbeatly platform.