Configure Kubernetes v1.16.2 cluster using Vagrant

Hi ,

Configuring Kubernetes cluster is not that difficult for an experienced Dev-op , but still its more time consuming procedure when it comes to create a test lab environment. For newbies its even harder.

So , for this post lets discuss about Kubernetes vagrant setup.

Assuming that you are already familiar with Vagrant.

If not,  refer Vagrant web .

Step1 . Install & Configure Vagrant

Download respective package from https://www.vagrantup.com/downloads.html .

For CentOS 7 & 8

# dnf install https://releases.hashicorp.com/vagrant/2.2.6/vagrant_2.2.6_x86_64.rpm

For Debian & Ubuntu

# dpkg -i https://releases.hashicorp.com/vagrant/2.2.6/vagrant_2.2.6_x86_64.deb

Check your installation,

# vagrant version

Installed Version: 2.2.6
Latest Version: 2.2.6
You’re running an up-to-date version of Vagrant!

Step2 . Setup K8s cluster

In this setup , we are using Virtual Box as hypervisor.

Ensure that Virtual Box is up and running.

Clone or download vagrant file and scripts from github repo.

# wget  https://github.com/jamesarems/kubernetes-ubuntu/archive/1.0.1.tar.gz

# tar -xvf 1.0.1.tar.gz

# cd kubernetes-ubuntu-1.0.1

# vagrant up

It will take couple of minutes to configure your setup. Once its done, do

# vagrant ssh km1

Check your nodes with  kubectl get no -o wide

NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
km1 Ready master 2m v1.16.2 192.168.33.10 <none> Ubuntu 16.04.6 LTS 4.4.0-165-generic docker://18.9.0
ks1 Ready <none> 2m v1.16.2 192.168.33.11 <none> Ubuntu 16.04.6 LTS 4.4.0-166-generic docker://18.9.0

Cheers..! Our cluster is ready for testing.

If you need to add more resource like memory ,  cpu , additional node – Edit Vagrantfile.

For any help, comment here! or reach me at jamesarems[at]hotmail[dot]com

This setup is very useful, if you are preparing for CKA (Certified Kubernetes Administrator).

See you again with another article.!

 

Leave a comment