Hello, readers! This article talks about Installing the Kubeadm package for Kubernetes cluster creation with a detailed explanation.
So, let us begin!!
What is a Kubeadm package?
Kubeadm is a software tool that enables us to bootstrap a cluster easily. With kubeadm, we can easily install different components of the cluster and bootstrap them together. It also enables us to join different worker nodes to the master node so that all belong to the created cluster.
For the same, we need to have at least one master node and one or more worker nodes to perform bootstrapping of the cluster.
Pre-requisites to create a Kubernetes Cluster
At first, it is necessary for us to have a master node ( a server or a VM) and a worker node as well. You can provide the same through minikube or through managed cloud providers such as GCP, Azure, Amazon, etc.
As a part of the cluster installation and bootstrapping, we would need to have the following components/packages on all the master and worker nodes-
- kubeadm: the package to install and bootstrap the cluster.
- kubelet: This component is responsible for starting and running all the pods and containers within the cluster. Thus, it is mandatory to be present on all the machines (master node as well as worker nodes)/
- kubectl: With this software tool, we can connect to the cluster and kube API server through command line easily and get all the information with regards to the cluster.
Apart from this, it is necessary for us to have a Container runtime installed on all the machines. Container runtime is responsible to run and monitor the health of containers within every pod in a cluster. By default, Container Runtime Interface (CRI) is used by Kubernetes as a container interface.
In case if we do not specify any container runtime plugins, then kubeadm will try to detect any installed container runtime by checking through the list of Unix sockets and paths-
|Runtime||Path to Unix domain socket|
Steps to install a kubeadm package for Kubernetes cluster installation
Let us now install the kubeadm package on all the nodes which we want the cluster to be a part of.
- At first, we update the apt package and install all the packages which are needed to use apt repository-
sudo apt update sudo apt install -y apt-transport-https ca-certificates curl
2. Now, we download the Google Cloud public signing key-
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
3. Addition of the Kubernetes apt repository-
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
4. Having added the apt repository, let us now update the apt package index-
sudo apt update
5. Now is the time to install kubelet, kubectl and kubeadm packages on all the nodes-
sudo apt install -y kubelet kubeadm kubectl sudo apt-mark hold kubelet kubeadm kubectl
These all 5 steps need to be executed on all the nodes which we plan to include as a part of the cluster.
Once done, it is important for us to configure a cgroup driver which enables us to manage cgroups on Linux machines. Also, kubeadm does not install or manage kubectl or kubelet packages on any of the cluster nodes. For the same, we need to make sure that we install these packages on all the nodes.
Please refer to this document to configure a cgroup driver.
By this, we have approached the end of this topic. Feel free to comment below, in case you come across any questions.
For more such posts related to Docker and Kubernetes, Stay tuned with us.
Till then, Happy Learning!! 🙂