Multi-Cloud Setup of Kubernetes Cluster

Sunil Sirvi
3 min readJun 19, 2022

Hello guys, In this blog I will show you how to setup Multi-Cloud Multi-Node Kubernetes cluster.

Master Node in AWS Cloud

I will setup 1 master node in Aws Cloud using Ansible playbook.

After running the playbook to launch instances on AWS, we can check that two instances are launched with the names Master and Slave.

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

1. Create a Virtual machine

2. Choose Authentication type as password

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

Now follow these steps :

  • Install docker.
yum install docker -y
  • Configure Docker cgroup driver as systemd
vim /etc/docker/daemon.json{
"exec-opts":["native.cgroupdriver=systemd"]
}
  • Restart docker and enable docker services.
systemctl restart docker
systemctl enable docker --now
  • Configuring kubernetes repo file
vim /etc/yum.repos.d/kubernetes.repo

Write below code 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 we will install kubadm , kubelet and kubectl commands using yum command :

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.confnet.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
  • Now, our slave is ready to join. Go to master node and print the join command.
kubeadm token create --print-join-command

Now we got the nodes in master and you will see slave1 and slave2 is joined with master and a cluster is formed.

Finally we have deployed Multi-Cloud Multi-Node Kubernetes cluster using Ansible.

___________Thank You for reading____________

--

--

No responses yet