Akshat Soni

Jul 2, 2020

5 min read


In this blog, i will tell you how to setup a complete multinode kubernetes cluster on top of the virtual machine using RHEL8.

In a cluster we can use multiple VM’s , cloud platforms or different laptops to expand our resources. This structure can help us in many different ways. In this setup master plays an important role as it decides where the new pods run and recieves requests from the user or admin. At the same time it can also run the pods in its resources too.

We start this by setting up the Redhat cli on VM. Refer this video:-https://youtu.be/X9TqgjqvIFw

Now after installing the Redhat cli version their are a number of softwares and os settings which are same for both the Master node and the Slave node. Instead of creating the vm again and again we can clone this for the slave nodes.

First install the docker container inside the VM1 using yum install docker-ce — nobest.

We can use different container engines like podman ,crio. In my case I have used the Docker engine. Its the most important part in the cluster as the Kubernetes use a no of different services like KubeAPI server , Kubelet, Kube scheduler, Kube controller etc. and for all these services to continuosly running they need the containerization technology. Use of these services are as follow:

KubeAPI server: This program is used to recieve the requests like running pods , containers ,deployment etc. from the user or admin using kubectl program.

Kube scheduler: This program is an intelligent program and decides where to launch the pods by checking the no of pods running on different slave nodes

Kube controller: This program is used to checking or monitor the running pods.

And also the permanent data like the secret file is stored in an etcd database.

After installing the programs we need to install all the programs for kubernetes. Run the commands given below in the screenshot

After installing the programs we need to disable the firewall and selinux security as it will show some conflicts after installing the kubernetes program.

Use systemctl disable firewalld to permanently disable the firewall and go to /etc/sysconfig/selinux and change the permission to permissive.

Now after all this we have one more situation to resolve. Create a file using vim /etc/docker/daemon.json and write the code as given in the screenshot. And then restart the services and also enable the docker services. The systemd driver is used to give an isolated system to a pod.

Now after this we need to remove the swap control and install iproute-tc to manage the traffic between the master and slave nodes. Use vim /etc/fstab and comment the swap line as shown and use yum install iproute-tc

Now enable the kubelet services and then power off the VM and clone accordingly. Till this part all the slaves and the master nodes have same configuration. After cloning the VM run the master node and change the local host name so that it wont give error while setting the DNS ip. To change the name use hostnamectl set-hostname master and do same for the slaves. After changing the name update the names with the IP in the /etc/hosts files as shown

Check the connectivity between VMs by ping with their name and IP address.

Note: They will work only when the VM is running in the Bridged Adapter mode.

After pinging setup the cluster in the master node using kubeadm init — pod-network-cidr= or This process will do a precheck and download some docker images and then give you a link to connect the slaves to the master.

But before that we need to create an overlay network so that their will be connectivity between different pods. For that use kubeadm apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

Now we can use the master node or the windows as user to run or deploy multiple containers using kubectl command.

I have tried to write the blog in the same sequence as Vimal Sir has explained. If anyone has doubt feel free to contact me.

LinkedIN profile: https://www.linkedin.com/in/akshat-soni-011b461a6