In this tutorial you can experiment with a local Kubernetes cluster that can be installed using VirtualBox or another virtualization product. This time we will use VirtualBox and Vagrant to set it all up. The Vagrant file will create one Kubernetes master server and two Kubernetes workers. A loadbalancer will also be created and will be used in our next blog about Traefik. After the installation we use Lens to connect to the created cluster. You must have a minimum of 16 GB of RAM for setting up this cluster.
To get started, make sure you download and install Vagrant, VirtualBox and Lens if you don’t already have them.
Vagrant
VirtualBox
Lens
First, we will install the boxes. In your terminal do the following:
Getting the master, workers and loadbalancer.
Bootstrap
Copy config file to communicate with the cluster
Deploy a pod network to the cluster
Check running pods
Get the following information out of the kubeadm-init.out for joining the worker in the cluster.
Lens is the only IDE you’ll ever need to take control of your Kubernetes clusters. It is a standalone application for MacOS, Windows and Linux operating systems. It is open source and free. After you have installed Lens you can connect to your cluster using the Kubernetes config file, the only thing you have to do is change:
“server: https://k8smaster:6443” to “server: https://192.168.33.20:6443”
On k8smaster get the config file:
Start Lens and add the config file, don’t forget to change the server into https://192.168.33.20:6443.
Learning and starting with Kubernetes clusters on your local device with Lens is fun and a good starting point to experiment with Kubernetes.
Good luck and feel free to reach out if you have any questions or ideas.