Multi-Cloud Multi-Node Kubernetes Cluster

Hello Readers😁

In this particular blog, I am going to set up Multi-Node Kubernetes Cluster on Multi-Cloud.

What I mean by this? Ans Why Multi-Cloud ?

  • According to a Survey, 81% of organizations are working with two or more public cloud providers.

  • A multi-cloud strategy gives companies the freedom to use the best possible cloud for each workload.

How to configure Multi-Cloud Multi-Node Kubernetes Cluster?

Here I am going to set up 1 Master Node in AWS Cloud and 1-1 Slave Node in AWS and Azure respectively.

In one of previous blogs I had described How to Set Up Multi-Node Kubernetes Cluster Over AWS using Ansible. There I created 1 master and 1 slave in AWS cloud. In the Same manner to setup nodes in AWS, I will be using Ansible.To know more about Ansible and How did I do that set up, Visit to that blog.(inline Linked above)

After running the playbook to launch instances on AWS,we can check the AWS EC2 management console. Two instances are launched with the tag names Master and Slave respectively.
alt text
Further I created the roles for Master and Slave respectively. You can visit my previous blog for more info.

Now I am going to set up 1 Slave Node in Azure Cloud. Here I am manually setting up the Slave node in Azure.

  • Create a virtual Machine alt text
  • Choose the authentication type as password and give the required user-name and Password

You can add the inbound rule and outbound rule and allow all the ports afterwards by going in networking section.
alt text

Now you can follow the following steps in Azure :

  • Install docker and enable it.

yum install docker -y
systemctl enable docker --now

  • Configuring Docker cgroup diver as systemd

vim /etc/docker/daemon.json{
"exec-opts":["native.cgroupdriver=systemd"]
}

  • Restart docker and enable it

systemctl restart docker
systemctl enable docker --now

  • Configuring kubernetes repo

vim /etc/yum.repos.d/kubernetes.repo

Write this in above file

[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-\$basearch
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
exclude=kubelet kubeadm kubectl
-Now you can install kubadm , kubelet and kubectl

yum install -y kubelet kubeadm kubectl — disableexcludes=kubernetes

  • Enabling kubelet service

systemctl enable kubelet --now

  • Install iproute-tc and configure IPtable

yum install iproute-tc

  • GO to this file

vim /etc/sysctl.d/k8s.conf

net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1

  • Key point: In Azure Podman is already Pre-installed so remove Podman and install docker

Podman remove command: yum remove podman

  • Now, our slave is ready to join. Go to master node and print the join command.

kubeadm token create --print-join-command

  • Finally get the nodes in master and you will see slave1 and slave2 is joined with master and a cluster is formed. alt text

Following is the Github Repository for your reference

Connect with me on LinkedIn

I hope you got something New out of it.

Thanks For Reading.

Keep Learning, Keep Hustling🎯🎯

19