Multi — Cloud K8S Cluster

Source : Owner

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

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 using Ansible playbook.

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.

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
  • 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.

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.
  • Finally we deployed Multi-Cloud Multi-Node Kubernetes cluster using Ansible.

Thank You for reading & learning with me.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store