Installing Kubeadm

How to install Kubeadm Effectively? If you have this question, then don't worry. You have landed on the perfect article. In this article, you will get an overview of Kubeadm followed by a detailed walkthrough of Kubeadm installation. By the end of this article, you will successfully install Kubeadm on your machine. Let's start.

You may not always want to go through the complicated process of installing Kubernetes, which includes several components, dependencies, and setup. This is when "kubeadm" comes into play. It takes away the complexities and automates the control plane bootstrapping process. Kubeadm makes it easier for users to create Kubernetes clusters with minimum effort.

This article will give you an overview of “kubeadm” and will show you how to install this toolbox in simple steps.So let’s start

Table of Contents

What is Kubeadm?

Kubeadm is a command-line utility developed by Kubernetes to facilitate the setup of a Kubernetes cluster. Its purpose is to simplify the process of setting up the Kubernetes cluster. Kubeadm performs several prechecks to ensure that the server has all the essential components to run Kubernetes.

Newbies who are new to Kubernetes and cannot manually configure each component of the cluster can use "kubeadm". It performs and manages all the complex tasks involved in creating a Kubernetes cluster. Kubeadm can be used in various environments for cluster development, testing, and production.

If you want to enrich your career and become a professional in Kubernetes, then enroll in "Kubernetes Online Training". This course will help you to achieve excellence in this domain.

Features of Kubeadm

Several key features make Kubeadm an efficient tool for setting up the Kubernetes cluster. These are stated below:

  • Cluster Initialization: “kubeadm init” bootstraps the Kubernetes control plane on the master node. It initializes etcd, API server, control manager, and the scheduler.
  • Joining Nodes: We can directly join worker nodes to an existing Kubernetes cluster using the "kubeadm join" command. It establishes communication between the worker node and the control plane.
  • Manages the Control Plane: Kubeadm handles the creation and management of control plane components. It also manages tasks like certificate generation and renewal and ensures the secure configuration of the control plane.
  • Configuration Management: It generates necessary configuration files like ‘kubelet’, ‘kubectl’, and ‘kube-proxy’. These files are automatically created based on the cluster's setup settings.
  • Cluster Reset: Kubeadm command can reset the cluster to its initial state. It is useful for cleaning up and resetting the configuration.

Prerequisites to Install Kubeadm

Following are the prerequisites to install Kubeadm:

  • A suitable Linux host is required because the Kubernetes project includes Linux distribution instructions.
  • At least 2GB of RAM and 2 CPUs per machine is the minimum requirement for a simple cluster.
  • A properly configured network amongst all cluster machines.
  • Unique Mac Address, hostname, and product_uuid for every node.
  • Swap must be disabled on all nodes (‘swap-off -a’) for Kubelet to work.
  • Certain ports must be opened on your machine.

[ Check out Top Kubernetes Projects For Beginners ]

Kubeadm Required Ports

After following all the prerequisites, the next step is to check the required ports for the installation of Kubeadm. These ports must be opened in order for Kubernetes components to communicate with each other.

1. Master Nodes:

ProtocolDirectionPort RangePurposeUsed By
TCPInbound6443*Kubernetes API ServerAll
TCPInbound2379-2380etcd server client APIkube-apiserver, etcd
TCPInbound10250Kubelet APISelf, Control plane
TCPInbound10251kube-schedulerSelf
TCPInbound10252kube-controller-managerSelf

2. Worker Nodes:

ProtocolDirectionPort RangePurposeUsed By
TCPInbound10250Kubelet APISelf, Control plane
TCPInbound30000-32769NodePort ServicesAll

Installing a Container Runtime

Kubernetes runs on container technology and Docker is the most popular container runtime. Kubernetes uses the Container Runtime Interface by default to interface with your chosen container. Install Docker on all the nodes in the cluster. Refer to Docker's official document for its installation. Kubeadm throws an error if no container runtime is detected.

Because the Docker engine does not support CRI, an extra service called cri-dockerd must be installed. “cri-dockerd” is a Docker implementation of the CRI specification that runs alongside ‘dockerd’ (Docker daemon). It bridges the communication between Kubernetes and Docker.

Below are the endpoints for the supported operating system:

Linux:

RuntimePath to Unix domain socket
containerdunix:///var/run/containerd/containerd.sock
CRI-Ounix:///var/run/crio/crio.sock
Docker Engineunix:///var/run/cri-dockerd.sock

Windows

RuntimePath to Unix domain socket
containerdnpipe:////./pipe/containerd-containerd
Docker Enginenpipe:////./pipe/cri-dockerd


MindMajix Youtube Channel

[ Check out Installation of Kubernetes on Ubuntu ]

Installing Kubeadm, Kubectl, Kubelet

After installing a container runtime, it's time to install Kubeadm, Kubectl, and Kubelet. Below is a brief explanation of these packages:

  • Kubeadm - It is a simple way of bootstrapping the Kubernetes cluster.
  • Kubectl - It serves as the primary interface for interacting with the Kubernetes cluster.
  • Kubelet - It is responsible for maintaining and managing individual nodes in the Kubernetes cluster.

Below are the steps of Debian-based distributions for installation of Kubeadm:

Step 1: Update the apt package index and install the packages:

sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl
Apt Package Index

Step 2: Download Google Cloud public signing key:

curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-archive-keyring.gpg
Google Cloud Signing Key

Step 3: Add Kubernetes apt repository:

echo "deb [signed-by=/etc/apt/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
Kubernetes Apt Repository

Step 4: Update apt package and install kubeadm, kubectl and kubelet:

sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl

Installing Kubeadm

 

[ Related Blog: How To Install React JS? ]

Kubeadm Installation FAQs

1. Where should Kubeadm be installed?

Kubeadm can be installed on various systems, like cloud servers, laptops, Raspberry Pi etc. It can also be integrated with platforms like Ansible and Terraform. It is an important part of cluster deployment as it helps in setting up clusters.

2. What is Kubeadm used for?

Kubeadm is a tool that manages and bootstraps Kubernetes clusters. Kubeadm init and kubeadm join act as fast paths to create a cluster. It automates tasks like initialization, networking, etc.

3. Can I use kubeadm to test Kubernetes?

Yes, kubeadm can be used to test Kubernetes clusters. This can be done through commands like "install docker”, ”install kubeadm, kubelet, and kubectl”, and initialize the cluster using “kubeadm”.

4. Does Kubeadm install CoreDNS?

Kubeadm generates CoreDNS Configuration while upgrading a cluster using kube-dns. The kubeadm commands deploy the CoreDNS as the default DNS provider.

5. How do I join a cluster using kubeadm?

To join a cluster with kubeadm, generate a join token on the master node. After that, run the join command on the worker nodes to connect the cluster. Verify the nodes to complete the joining.

Learn Kubernetes Interview Questions and Answers that help you grab high paying jobs

Conclusion

That’s it! You have now installed Kubeadm successfully. Keep in mind that "kubeadm" is a crucial tool that creates, manages, and simply upgrades Kubernetes clusters. It is a recommended starting point for anyone to set up a Kubernetes cluster. I hope this article was able to give you a simple explanation of how to install Kubeadm.

Job Support Program

Online Work Support for your on-job roles.

jobservice

Our work-support plans provide precise options as per your project tasks. Whether you are a newbie or an experienced professional seeking assistance in completing project tasks, we are here with the following plans to meet your custom needs:

  • Pay Per Hour
  • Pay Per Week
  • Monthly
Learn MoreGet Job Support
Course Schedule
NameDates
Kubernetes TrainingNov 19 to Dec 04View Details
Kubernetes TrainingNov 23 to Dec 08View Details
Kubernetes TrainingNov 26 to Dec 11View Details
Kubernetes TrainingNov 30 to Dec 15View Details
Last updated: 21 Sep 2023
About Author

Viswanath is a passionate content writer of Mindmajix. He has expertise in Trending Domains like Data Science, Artificial Intelligence, Machine Learning, Blockchain, etc. His articles help the learners to get insights about the Domain. You can reach him on Linkedin

read less