Kubeadm is a tool(utility) built to provide “kubeadm init” and “kubeadm join” as best-practice “fast paths” for creating #Kubernetes clusters.
It performs the actions necessary to get a minimum viable cluster up and running.
By design, it cares only about bootstrapping, not about provisioning machines. Likewise, installing various nice-to-have addons, like the #Kubernetes Dashboard, monitoring solutions, and cloud-specific addons, is not in scope.
Instead, we expect higher-level and more tailored tooling to be built on top of kubeadm, and ideally, using kubeadm as the basis of all deployments will make it easier to create conformant clusters.
We will have 3 VM’s running from which 1 will be a master and other 2 will be the worker nodes. Below are the steps to be followed to deploy a master-node structured #Kubernetes cluster using Kubeadm
#Install Docker on 3 machines
Commands:
sudo yum install -y yum-utils
sudo yum-config-manager — add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install -y docker-ce docker-ce-cli containerd.io
#Start the Docker Service
sudo service docker start
docker system info | grep -i driver
vi /etc/docker/daemon.json
{
“exec-opts”: [“native.cgroupdriver=systemd”]
}
systemctl daemon-reload && systemctl restart docker
docker system info | grep -i driver
# Disable swap memory
sudo swapoff -a
sudo sed -i ‘/ swap / s/^\(.\*\)$/#\1/g’ /etc/fstab
#Set SELinux in permissive mode (effectively disabling it)
sudo setenforce 0
sudo sed -i ‘s/^SELINUX=enforcing$/SELINUX=permissive/’ /etc/selinux/config
#Install kubeadm, kubelet and kubectl on all nodes
Create this file;
cat <<EOF | sudo tee /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-\$basearch
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=packages.cloud.google.com/yum/doc/yum-key.gpghttps://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
exclude=kubelet kubeadm kubectl
EOF
#Install all the three utilities on all the VM’s with the specific version that you want
yum install -y kubelet-1.22.5 kubectl-1.22.5 kubeadm-1.22.5 — disableexcludes=kubernetes
#Initialize Kubeadm
Command:
kubeadm init — apiserver-advertise-address=““add your master ip address””
#Deploy Calico network
kubectl — kubeconfig=/etc/kubernetes/admin.conf create -f https://docs.projectcalico.org/v3.14/manifests/calico.yaml
#Join the network
Join the remaining working nodes to the network with the kubeadm join command printed as output on the master
#Last steps will be creating the admin.conf file for kubernetes on both the worker nodes;
vi /etc/kubernetes/admin.conf
(add the admin.config file contents in there)
#Check the readiness.
kubectl get nodes
If while creating the cluster, there are some errors that are not getting resolved, please reset kubeadm by the below commands and perform the above steps carefully
****Reset kubeadm****
sudo kubeadm reset
rm -rf .kube/
sudo rm -rf /etc/kubernetes/
sudo rm -rf /var/lib/kubelet/
sudo rm -rf /var/lib/etcd
*********End********
Wasn’t this a piece of cake?
Want more, stay connected and read more and do visit our website https://mahiratechnology.com/