Kubernetes Cluster over Multi-Cloud

MD MOQADDAS
3 min readJul 17, 2021

--

Hello, In this article I am going to configure the Kubernetes cluster over multi-cloud means one instance over AWS, Azure, and One Local VM

Note-: All the steps are given in Red Hat Based Operating system, concept-wise same only some basic command varies.

Let’s start

How to Configure Kubernetes Master -:)

Either you can use a local VM or cloud

→ Configure this instance as

step1: Configure the Kubeadm Repo

Run command-: vim kubeadm.repo

[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

step2: Set the systemd

Run command → vim daemon.json

{
“exec-opts”: [“native.cgroupdriver=systemd”]
}

step3: Install docker

Run command → yum install docker -y

step4: Start the docker Service

Run command → systemctl start docker

step5: Downloading Kubeadm, kubelet, kubectl

Run Command

yum install -y kubelet kubeadm kubectl — disableexcludes=kubernetes

step6: Start the service of kubelet

Run Command

systemctl start kubelet

step7: pull require images

Run command

kubeadm config images pull

step8: Install the iproute-tc package

Run Command

yum install iproute-tc -y

step9: Initialize the cluster

Run Command

kubeadm init — pod-network-cidr=10.244.0.0/16

Here, — pod-network-cider=”you can use as your choice but if you change you have to edit also from other file otherwise cluster not work”

Note-: k8s cluster is little bit heavy, its need some more cpu so avoid this error use below option

— ignore-preflight-errors=NumCPU

— ignore-preflight-errors=Mem

step10: After Initialize the cluster they will give three commands run it without any hesitation okay.

Example given below-:

cp -i /etc/kubernetes/admin.conf $HOME/.kube/config

chown $(id -u):$(id -g) $HOME/.kube/config

kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

step11: Run Command to print joining command so that any worker node join

kubeadm token create — print-join-command

This command gives you one command, copy it, and run in the worker node so that the worker can join.

How to Configure the Kubernetes Worker Node

step1: Configure the Kubeadm Repo

Run command-: vim kubeadm.repo

[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

step2: Set the systemd

Run command → vim daemon.json

{
“exec-opts”: [“native.cgroupdriver=systemd”]
}

step3: Install docker

Run command → yum install docker -y

step4: Start the docker Service

Run command → systemctl start docker

step5: Downloading Kubeadm, kubelet, kubectl

Run Command

yum install -y kubelet kubeadm kubectl — disableexcludes=kubernetes

step6: Start the service of kubelet

Run Command

systemctl start kubelet

Now Join the Worker node to the master -:)

For this, we have only run the join command which we printed in master.

How to create multi-cloud setup -:)

I am going to launch the instance as follow

  1. One Over AWS
  2. One Over Azure
  3. One in Local VM
  4. Master Node in Local VM
  1. One Over AWS -:

Image_name: AMI Machine

Note-: You have to same steps which I tell you for worker node configuration.

2. One Over Azure -:

Image_name: Linux (redhat 8.2)

Note-: Same setup do which is for worker node

3. One in Local VM -:

Image_name: Red Hat Linux

Note-: Same for WorkerNode

4. Master Node in Local VM(you can use anywhere the step is same) -:

Image_name: Red Hat Linux

Note-: Do the same process which is for Kubernetes Master Node

At last, run the joining command to join with the master.

Keep Doing Keep Sharing

MD MOQADDAS

Extra Repo

Automate Ansible Cluster -: https://github.com/MDMOQADDAS/Launch-Kubernetes-Cluster-Over-AWS-using-Ansible.git

Configure k8s cluster using Ansible -: https://github.com/MDMOQADDAS/Ansible-role-for-configure-Kubernets-Clusture.git

See Soon

--

--

MD MOQADDAS
MD MOQADDAS

No responses yet