Creating multi-node and multi-cloud Kubernetes cluster

Kubernetes:

Kubernetes, also known as K8s, is an open-source system for automating deployment, scaling, and management of containerized applications.

Amazon Web Service :

We can define AWS (Amazon Web Services) as a secured cloud services platform that offers compute power, database storage, content delivery, and various other functionalities. To be more specific, it is a large bundle of cloud-based services.

Microsoft Azure

Azure is a public cloud computing platform — ith solutions including Infrastructure as a Service (IaaS), Platform as a Service (PaaS), and Software as a Service (SaaS) that can be used for services such as analytics, virtual computing, storage, networking, and much more. It can be used to replace or supplement your on-premise servers.

— — — — — — — — — — — — — — — — — — — — — — — — — — — -

Let’s start..

In this article, we are going to configure the Kubernetes multi-node cluster. Where we have configured the master in AWS, One slave in AWS, One slave in Microsoft azure, Two slaves in Local virtual instance.

  • First, launch two basic EC-2 instances in AWS one for master and one for slave.
  • Launch one vm on Azure to configure as slave of k8s cluster
  • One Local VM is required to make slave of k8s cluster.

Open the Linux terminal, Now we are going the configure the Kubernetes master.

Kubernetes uses container technology, Therefore we are installing docker.

Now, start and enable the docker service.

Changing the docker driver from cgroupfs to systems:

To apply this driver we need to restart the docker service

To install Kubernetes into the system first we need to configure the k8s repository.

Installing the required packages to run the master node

kubeadm — Kubeadm is a tool built to provide kubeadm init and kubeadm join as best-practice “fast paths” for creating Kubernetes clusters.

kubectl — You can use kubectl to deploy applications, inspect and manage cluster resources, and view logs

kubelet — The kubelet is the primary “node agent” that runs on each node. It can register the node with the apiserver using one of the hostnames.

Starting and enabling the kubelet service.

To set up the Kubernetes cluster. We need to pull docker images using kubeadm. It pulls images of the config files.

Installing “iproute-tc” which will help us to manage the traffic on the cluster

Now, lets change IP tables /etc/sysctl.d/k8s.conf

The important step: Initializing Master

Now the master is initialized.

Run the above commands.

To connect the nodes of the master and slave we use a flannel. Flannels act as a DHCP server as well as a router in the cluster. It will create a nating between the pods running in the cluster. The flannel works on the underlying network.

The above command will download and apply the flannel.

Generating Token:

The token is created at the time of initializing the master

This will print the token which we have to run on the slaves.

Now, The master is ready.

🔰 Slaves Configuration:

We are going the launch one slave in AWS, Second in Azure, third and fourth in local systems.

Perform all the below mentioned steps in all of those slave.

The above command I explained in detail while creating the master, they have the same meaning as in the master.

First, let’s connect the local systems.

Disable swap in the local systems

→ swapoff -a

Now, go to the master and print the token using the join command.

Copy the above-printed token and run it on all the slaves

Check the nodes using

  • output of above command

One slave is connected through AWS, master.lw.example.com and mlops-node are from the local systems.

In the azure instance the inbound and outbound rule are as follow:

Successfully created multi-node and multi-cloud Kubernetes cluster.

Thank you for visiting my article.

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

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