MYHOSPITALNOW.COM

Find Trusted Doctors & Hospitals

Discover healthcare providers, compare hospitals, and explore treatment options worldwide.

Free Treatment Quotes • Doctor Search • Hospital Comparison

Find Healthcare Options

www.myhospitalnow.com

Setting up Kubernetes Clusters using Kubeadm Manual way in RHEL 7 / Centos7

What is Kubeadm?

Kubeadm helps you bootstrap a minimum viable Kubernetes cluster that conforms to best practices. Kubeadm is a tool built to provide kubeadm init and kubeadm join as best-practice “fast paths” for creating Kubernetes clusters.

Goal

  • To Install a single master Kubernetes cluster
  • To Install a high availability master Kubernetes cluster
  • To Install a Pod network on the cluster so that your Pods can talk to each other.

kubeadm’s simplicity means it can serve a wide range of use cases:

  • New users can start with kubeadm to try Kubernetes out for the first time.
  • Users familiar with Kubernetes can spin up clusters with kubeadm and test their applications.
  • Larger projects can include kubeadm as a building block in a more complex system that can also include other installer tools.

Pre-requisite

  • One or more machines running a deb/rpm-compatible OS, for example Ubuntu or CentOS
  • 2 GB or more of RAM per machine. Any less leaves little room for your apps.
  • 2 CPUs or more on the master
  • Full network connectivity among all machines in the cluster. A public or private network is fine

Pre-requisite – Installing Docker [ This need to be there in Master and Worker Node. Both]

As part of the installation, every node (master and minions) needs:

  • kubeadm: the command to bootstrap the cluster.
  • kubelet: the component that runs on all of the machines in your cluster and does things like starting pods and containers.
  • kubectl: the command line util to talk to your cluster.
  • Docker: Container Enginer
  • CNI: Container Network interfacer

Master: Setting Up a Kubernetes Control Plane


Step 1 – Change VMs Mac Address in Virtual box -> Setting -> Network ->Advance

Note – Please POWER off the VM before changing Mac Address.

VirtualBox Network settings for powered-off CentOS VM, regenerating the MAC address on a bridged adapter, then OK

Step 2 – Change Host Name of Master Server


$ hostnamectl set-hostname rajesh.master.comCode language: JavaScript (javascript)

Step 3 – Stop and Disable Firewall


$ systemctl stop firewalld
$ systemctl disable firewalld

Step 4 – Disable swap


$ sudo swapoff -a
$ sudo sed -i '/ swap / s/^/#/' /etc/fstab

# Reboot a machine after that.	
$ shutdown -r nowCode language: PHP (php)

Step 5 – Install and Start Docker Community Editon in Master Server

Special Step – For Docker Only with Kubernetes 1.22

Step 6 – Setup yum repo for kubelet kubeadm kubectl

Step 7 – Set SELinux in permissive mode (effectively disabling it)


$ setenforce 0
$ sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/configCode language: JavaScript (javascript)

Step 8 – Install kubelet kubeadm kubectl and enable kubelet


$ yum install -y kubelet-1.22.0-0.x86_64 kubeadm-1.22.0-0.x86_64 kubectl-1.22.0-0.x86_64 --disableexcludes=kubernetes
$ systemctl enable --now kubelet

# Latest 
$ yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes
# Kubernetes 1.23 
$ yum install -y kubelet-1.23.0-0.x86_64 kubeadm-1.23.0-0.x86_64 kubectl-1.23.0-0.x86_64 --disableexcludes=kubernetes
# Kubernetes 1.22
$ yum install -y kubelet-1.22.0-0.x86_64 kubeadm-1.22.0-0.x86_64 kubectl-1.22.0-0.x86_64 --disableexcludes=kubernetes
# Kubernetes 1.21
$ yum install -y kubelet-1.21.0-0.x86_64 kubeadm-1.21.0-0.x86_64 kubectl-1.21.0-0.x86_64 --disableexcludes=kubernetes
# Kubernetes 1.20
$ yum install -y kubelet-1.20.0-0.x86_64 kubeadm-1.20.0-0.x86_64 kubectl-1.20.0-0.x86_64 --disableexcludes=kubernetesCode language: PHP (php)

Step 9 – Finally, initialize a kubernetes clusters


$ kubeadm init --ignore-preflight-errors all

# How to install older version of Kubernetes
# kubeadm init --kubernetes-version=v1.9.2  Code language: PHP (php)

Step 10 – Output

Kubeadm init output: Your Kubernetes control-plane has initialized successfully, with kubeconfig and join commands

Workstation: Setting Up a Kubernetes Workstation


Step 11 – Setup Workstation in the Master node only. You can be regular user for it.


$ mkdir -p $HOME/.kube
$ sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
$ sudo chown $(id -u):$(id -g) $HOME/.kube/configCode language: PHP (php)

Step 12 – Verify Clustors


$ kubectl get nodes
$ kubectl get pods --all-namespacesCode language: JavaScript (javascript)

Kubectl get nodes shows master NotReady and CoreDNS pods Pending before pod networking is installed

Step 13 – Install Kubernetes pod networking

Weave Net provides networking and network policy, will carry on working on both sides of a network partition, and does not require an external database. Kubernetes versions 1.6 and above:


$ kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
$ kubectl get nodes
$ kubectl get pods --all-namespaces
$ kubectl get nodesCode language: JavaScript (javascript)

After installing Weave Net, kubectl shows master node Ready and CoreDNS and weave-net pods Running

Worker: Setting Up a Kubernetes Worker


Step 14 – Setup nodes [ In the node aka worker


# Follow Step 1 
# Follow Step 2
# Follow Step 3
# Follow Step 4
# Follow Step 5
# Follow Step 6
# Follow Step 7
# Follow Step 8

# Run following commands which we got from kubeadm init
$ kubeadm join 172.31.31.106:6443 --token pdn6in.r0dzhpx1ucrs69au --discovery-token-ca-cert-hash sha256:a9385951e659a3c67f55ccfbdc1169b1f660ba09aaf8cc6d5cc96d71b71900d2Code language: PHP (php)

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

How to install Ansible in Centos 7/RHEL 7?

On CentOS 7 or RHEL 7 you can install Ansible in two ways: with yum from the EPEL repository, which gives you Ansible 2.9, or with pip…

Read More

Kibana 7.2 Install and configuration in RHEL 7/Centos

This guide covers installing Kibana 7.2 on RHEL 7 or CentOS 7 from the tar.gz archive, pointing it at an Elasticsearch cluster in kibana.yml, and starting it….

Read More

Docker Tutorials: Installation and Configurations

Docker Installation in Centos/RHEL Method -1: How to install Docker Community Edition via YUM? Step 1 – Install required packages. yum-utils provides the yum-config-manager utility, and device-mapper-persistent-data…

Read More

What is yum and use cases of yum?

What is yum? yum, short for Yellowdog Updater Modified, is a command-line package management utility for RPM (Red Hat Package Manager)-based Linux distributions, such as CentOS and…

Read More

Puppet Tutorials: Installing and Configure Puppet Server & Agent

Setting up Puppet Server in RHEL 8 / CENTOS 8 Setting up Puppet Agent in Linux Configure Puppet Agent with Server Rajesh Kumar I’m Rajesh Kumar, a…

Read More

Git Install and Upgrade from Source in RHEL / CENTOS

This tutorial will help you to install git 2.9.5 on CentOS/RHEL 7/6/5 and Fedora 26/25/24 operating systems using the source code. Step 1 – Install Required Packages…

Read More