Creating, Starting, Stopping, Packaging and Publishing a Vagrant Box

I use Vagrant for local development in order to build any development environment. For example, when I need a Kubernetes multi node cluster, I can demonstrate with Vagrant quickly(https://kenanhancer.com/2019/09/08/kubernetes-multi-node-cluster-with-one-updated-vagrant-file/). After I complete my exercise about any technology, I also publish to Vagrant Cloud so that it can be used later without wasting time. But, I am not using only Vagrant, there are different technologies and there are different CLI for them. So, if I don't use one technology sometime, I can forget some important commands. That's why, this post is important for me to remember Vagrant CLI 🙂

To read more information about Vagrant CLI https://www.vagrantup.com/docs/cli/ follow official link.

Continue reading

Kubernetes multi node cluster with One Updated Vagrant File

Actually there is already a Kubernetes multi node cluster post (https://kenanhancer.com/2018/09/26/kubernetes-multi-node-cluster-with-vagrant/) in this blog. But, this one is different. That post was showing 3 empty virtual server up and run later install tools step by step so it was taking too much time. If you run this Vagrantfile, it will create one master node and 2 worker nodes in Virtualbox. This Vagrantfile is also more configurable. If you need more servers, just append new item in "servers" array in Vagrantfile.

This is the expected result 🙂 As I mentioned at the beginning of the post, one master node and two worker nodes are created in Virtualbox.

Kubernetes single node cluster with Minikube and Vagrant

The following Vagrantfile code(syntax is Ruby) is creating single node Kubernetes cluster with Minikube.

Copy above code and follow the following screenshots. Run the following commands in Terminal.

mkdir MinikubeVagrant

cd MinikubeVagrant

nano Vagrantfile

Paste the Vagrantfile content like below.

save Vagrantfile and run the following command to start virtual machine.

vagrant up

Creating Kubernetes Dashboard Proxy

After Vagrant is up, it means that Minikube is ready to use. So, connect with SSH to Vagrant machine and run the following code to start Kubernetes Dashboard Proxy.

kubectl proxy --address 0.0.0.0 --port=8001 --accept-hosts '.*'

Connecting to Kubernetes Dashboard from Host machine

Click one of the following link to connect the Dashboard. Ta taaa 🙂

http://127.0.0.1:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/#!/login

or

http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/#!/login

Rest of the details are already mentioned in this blog link Kubernetes multi node cluster with Vagrant (included Kubernetes Dashboards, Grafana, Prometheus)

read the Kubernetes Dashboard Access Control paragraph.

Docker VirtualBox with Vagrant

If you have installed Vagrant CLI (https://kenanhancer.com/2019/09/22/creating-starting-stopping-packaging-and-publishing-a-vagrant-box/), just run the following command to create docker installed virtual box.

The following command will download Vagrant box from Vagrant Cloud.

vagrant init kenanhancer/DockerMachine

This command will up and run the virtual machine in your VirtualBox. So you need to install VirtualBox as well 🙂

vagrant up

If you want to check status of virtual machine, run the following command.

vagrant status

If you want to see ports of virtual machine, run the following command.

vagrant port

to connect created virtual machine, run the following command in the Vagrantfile directory.

vagrant ssh

if you want to see details of Vagrantfile, check it as below.

Creating a Vagrant Package file

vagrant package --output dockermachine.box --vagrantfile Vagrantfile

Pushing Created Vagrant Package to Vagrant Cloud

After you create a Vagrant Package, run the following command in the package file location.

vagrant push

Kubernetes multi node cluster with Vagrant (included Kubernetes Dashboards, Grafana, Prometheus)

The following Vagrantfile code(syntax is Ruby) is creating one master node and two worker nodes for Kubernetes.

Go to Vagrantfile directory in Terminal and run the following code to create virtual machines.

The following Vagrantfile code(syntax is Ruby) is creating one master node and two worker nodes for Kubernetes.

Go to Vagrantfile directory in Terminal and run the following code to create virtual machines.

As you can see in the below picture, three virtual machines are obtained and running.

But, Kubernetes cluester is still not ready. We created just an environment to install the cluster.
Continue reading