Kubeadm
Estimated time to read: 5 minutes
System Requirement
Before we begin the installation process, ensure you have the following prerequisites:
- A minimum of three nodes (one master and two worker nodes) running either Red Hat Enterprise Linux 9 or CentOS 9.
- Each node should have a minimum of 2GB RAM and 2 CPU cores.
Prerequisites Configuration
-
If you do not have a DNS setup, each node should have the following entries in the
**/etc/hosts**
file for local name resolution.
Replace with your actual hostname and IP address
-
Install and add Kernel Headers on each node
-
First, ensure that you have the appropriate kernel headers installed on your system (on each node).
-
To load the necessary kernel modules required by Kubernetes, you can use the
**modprobe**
command followed by the module names (on each node). Here’s how you can do it -
Create a configuration file (as the root user on each node) to ensure these modules load at system boot
-
-
Configure Sysctl
-
To set specific
sysctl
settings (on each node) that Kubernetes relies on, you can update the system’s kernel parameters. These settings ensure optimal performance and compatibility for Kubernetes. Here’s how you can configure the necessarysysctl
settings
-
-
Disabling Swap
-
Turn the swap off as Kubernetes does not support it (To take effect Immediately).
-
comment out the swap filesystem entry in /etc/fstab for the persistence across reboot.
-
-
Install Container Runtime
we’ll install Containerd on each node. Containerd serves as a crucial container runtime responsible for managing and executing containers, which serve as the fundamental units of Kubernetes applications.
-
Add the Docker CE Repository
-
Install the containerd.io package:
-
Configure continerd
-
Run the following command to build out the containerd configuration file
-
Using your preferred text editor, open the
**/etc/containerd/config.toml**
file and set the SystemdCgroup variable to true (SystemdCgroup = true
):
-
-
Firewall rules
-
Allow specific ports used by Kubernetes components through the firewall, you can execute the following commands (on each node):
sudo firewall-cmd --zone=public --permanent --add-port=6443/tcp sudo firewall-cmd --zone=public --permanent --add-port=2379-2380/tcp sudo firewall-cmd --zone=public --permanent --add-port=10250/tcp sudo firewall-cmd --zone=public --permanent --add-port=10251/tcp sudo firewall-cmd --zone=public --permanent --add-port=10252/tcp sudo firewall-cmd --zone=public --permanent --add-port=10255/tcp sudo firewall-cmd --zone=public --permanent --add-port=5473/tcp
-
-
Kubernetes Repository
-
Add the Kubernetes repository (as the root user) to your package manager
-
-
Install Kubernetes Packages
-
Initializing Kubernetes Control Plane
-
Initialize the Kubernetes Cluster by running the "kubeadm init" command.
-
Let’s run the below commands to set variables to be able to manage kubernetes cluster.
-
-
Deploy Pod Network
- To enable networking between pods across the cluster, deploy a pod network. For example, deploy the Tigera Operator for Calico
-
Join Worker Nodes
-
List the nodes