Azure, Cloud Computing

5 Mins Read

A Guide to Setup a Kubeadm Cluster using Azure Cloud

Voiced by Amazon Polly

Overview

Kubeadm is a tool that performs the necessary actions to set up a minimal viable cluster and run quickly. Change is an integral part of the Kubernetes lifecycle. Some of its use cases include testing, creating baselines for advanced Kubernetes deployments, and providing beginners a starting point to configure the cluster properly.

Features of Kubeadm:

  • Easy to create a minimal viable cluster: Kubeadm is designed so that all the components are present in one place in a cluster.
  • Easily provision volumes from cross-namespace snapshot: This feature allows the end user to provision a volume from volume snapshot, which greatly benefits applications and users, For example, enabling administrators to snapshot a database before any critical operation.
  • It can set up a k8s cluster anywhere on a laptop or public cloud.

These are some of the features to consider. Now, let’s create a kubeadm cluster on the Azure Cloud platform.

Pioneers in Cloud Consulting & Migration Services

  • Reduced infrastructural costs
  • Accelerated application deployment
Get Started

Steps to create a Kubeadm cluster on the Azure Cloud platform

Step 1 – Create your cloud infrastructure, including one master VM and two worker nodes.

  1. Go to the Azure portal (portal.azure.com) and search for virtual machines in the search bar.
  2. Select the virtual machine and create an Azure Virtual machine for the master node as per the below configuration.

a. The required configurations are: Ubuntu 20.04 LTS image and atleast 4 GB of RAM each instance should have. (Here, we have selected 8 GB RAM and 2 vcpus)

step1

3. Set the username, generate a new keypair, and open the inbound port 22 on your VM.

4. Click on Review + Create. After successful validation, click on Create.

5. Don’t forget to download your keypair.

6. Once your master VM is created, follow the steps from 2 to 4 and create the other two worker nodes with the same configuration.

step1b

Step 2 – Run these commands on all the nodes.

  1. Take ssh of all the nodes (using Putty, mobaxterm, or any other tool).
  2. Run the below commands on all of your nodes.

3. Load the br_netfilter module to facilitate the virtual Extensible LAN (VxLAN) traffic for communication between pods across the cluster.

4. Setup containers, a container runtime that manages the lifecycle of the containers on a host, i.e., a daemon process that creates, starts, stops, and terminates the containers.

Above commands will install containerd version 2.

5. Now, pull the image for Kubernetes 1.26 version.

Step 3 – Run the kubeadm init on the control plane node (master node)

  1. In this command, the pod network CIDR depends on the container network interface, which we will be downloading later on and using flannel. The control-plane-endpoint parameter will be the public IP of the master node.

The above command will give the following output:

Copy the join command from the output to join the worker nodes.

step3

step3b

Note: If you receive any such error which says,

“Initial timeout of 40 seconds passed. Either your kubelet is not running properly, or the kubelet is unhealthy due to any of the misconfiguration in the node (cgroups disabled required)”

Then run these three below commands:

step3c

2. If everything works fine, then export KUBECONFIG and install CNI Flannel.

Step 4 – Run the kubeadm join command on all the worker nodes

  1. Run the kubeadm join command on both the worker nodes, which you copied earlier in the previous step.

step4

2. After running the above command, run ‘kubectl get nodes’ on the master node to check the joined worker nodes.

Once the cluster is up and running, you can create your pods running your application inside the cluster.

Conclusion

In this blog, we installed Kubernetes on the Kubeadm cluster. As a DevOps Engineer, we should understand the basic components of Kubernetes. While working with managed services, we often miss learning the basic building blocks of Kubernetes. This setup of the Kubeadm cluster is good for learning and playing around with Kubernetes. Having the whole cluster setup in virtual machines lets you learn all the cluster components configs and troubleshoot the cluster if there is any component failure.

Making IT Networks Enterprise-ready – Cloud Management Services

  • Accelerated cloud migration
  • End-to-end view of the cloud environment
Get Started

About CloudThat

CloudThat is also the official AWS (Amazon Web Services) Advanced Consulting Partner and Training partner and Microsoft gold partner, helping people develop knowledge of the cloud and help their businesses aim for higher goals using best in industry cloud computing practices and expertise. We are on a mission to build a robust cloud computing ecosystem by disseminating knowledge on technological intricacies within the cloud space. Our blogs, webinars, case studies, and white papers enable all the stakeholders in the cloud computing sphere.

Drop a query if you have any questions regarding Terraform, Kubernetes, Kubeadm and I will get back to you quickly.

To get started, go through our Consultancy page and Managed Services Package that is CloudThat’s offerings.

FAQs

1. For how long the token is valid?

ANS: – Kubeadm init creates an initial token for 24 hrs TTL. The commands allow you to manage a token and create new ones:

If no token is given, then it will generate a new token. The default TTL is 24 hrs.

2. How to use Kubeadm certs certificate-key?

ANS: – The command can generate a new control-plane certificate key which can be passed as –certificate-key to Kubeadm init, and Kubeadm join to enable the automatic copy of certificates when joining additional control plane nodes.

3. How to upgrade the Kubeadm version?

ANS: – The command checks which versions are available to upgrade to and verify whether your current cluster is upgradeable.

 

WRITTEN BY Harshita Gupta

Share

Comments

  1. Shreyas Gupta

    May 10, 2023

    Reply

    Insightful

  2. Prashant Khosre

    May 10, 2023

    Reply

    This is very useful information.

  3. Click to Comment

Get The Most Out Of Us

Our support doesn't end here. We have monthly newsletters, study guides, practice questions, and more to assist you in upgrading your cloud career. Subscribe to get them all!