Multi- Node Kubernetes Cluster Setup on Microsoft Azure Virtual Machine.

Deploying A Multi Node Kubernetes Cluster on Ubuntu Virtual Machine.

Kubernetes is basically a container orchestration platform that automates the deployment, scaling, and management of containerized applications.

Multi-Node Kubernetes Cluster is distributed computing architecture in which each node is a virtual machine or physical machine that runs containerized applications managed by Kubernetes. In Multi Node cluster each node (virtual machine) runs a Kubernetes engine which is called the Kubelet which communicates with the Kubernetes control plane to manage the containers running on that node. The control plane consists of several components, including the Kubernetes API server, etcd, kube-controller-manager, and kube-scheduler, which work together to manage the cluster's resources and workload and also helps in load balancing , scaling the systems and management of containerized applications.

Advantages of Multi-Node Kubernetes Cluster - 

Kubernetes cluster enables the horizontal scaling of applications across multiple nodes. It allows applications to be distributed and load-balanced across the cluster, improving performance, scalability, and fault tolerance
A multi-node Kubernetes cluster provides features such as automatic failover, self-healing, and rolling updates, which help to ensure the availability and reliability of the applications running in the cluster.

This blog is all about setting up a multi-node Kubernetes cluster on Ubuntu Server.

Lab Work :-

Step 1: Creating a ubuntu virtual machine on azure portal. And the virtual machine has some pre-requisite
Each virtual machine should have at least 2 cpu and 2gb of Ram.
At least the Ubuntu version should be 16.04. 6 LTS, or CentOS 7.5+ (in case of centos).





Step 2:- Similarly create another worker node.


Some Pre-requirements are needed to ensured on both the master as well as the worker nodes.

1.  The master-Node and all the worker-node should belong to the same virtual network. In case the nodes belong to different virtual network then we have to ensure virtual network peering among the virtual networks.

2. Ensure that all the node including the master and worker are able to ping each other with their ip address as well as their hostname.



If In case of azure virtual machine if you cannot ping other nodes from the master then you must allow the ICMP protocol in networking tab of all nodes.

3. Disable swap memory in all nodes. 
command to disable swap memory is :- swapoff -a


step 4:- After you disable the swap memory on both nodes the reboot both the master and worker nodes.
command to reboot instance is : - sudo reboot


step 5 : Update all the system packages.
command is :- sudo apt update.


step 6: - Installing docker on all the master and worker nodes.
command  to install docker is :- sudo apt-get install -y docker.io



Then start and check the status of the docker demon in all master and worker nodes.
command to start the docker demon :- systemctl start docker
command to check the status of docker demon is :- systemctl status docker.


step 7: - Install https support on all master and worker nodes.
command to install https support is :- sudo apt-get install apt-transport-https.


step 8:- Install curl on all nodes.
command to install curl is :- sudo apt-get install curl.


step 9:- Install the Google Cloud public signing key.
command  is:- curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -


Then add the Kubernetes apt repo by using the command :-
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list


step 10:- Update apt packages and Install kubelet, kubeadm and kubectl in all master and worker nodes.
command to install kubelet, kubeadm and kubectl is :-

sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl

The Kubelet , kubeadm, Kubectl are generally mark on hold because it is to prevent any kind of rolling updates.
In case of any confusion you can always check out the offical documentation of Kubernetes here.



step 11:- Initialize the master node using kubeadm.
command to Initialize the kubeadm is :- 
 sudo kubeadm init --pod-network-cidr=192.168.0.0/16


step 12 :- To start the cluster , you need to run the following command to initialize the .kube folder and allow permission on to it.

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config


step13 :- Join worker node to the master node using the Kubeadm join command.


step 14:- In order to see the Nodes connected to the cluster, use this command
Kubectl get nodes.


Thank you.

Sibasish

I am a student pursuing Computer Science and Engineering at Silicon Institute of Technology. I am always eager to explore the world of computer Science and software development . Main areas of interest include Web-development, Machine Learning, and Cloud Computing.

Post a Comment

Previous Post Next Post