Kubernetes Installation Step By Step

Kubernetes Installation on Ubuntu 22.04 LTS

Disable Swap (All Nodes)

To enhance Kubernetes performance, disable swap and set essential kernel parameters. Run the following commands on all nodes to disable all swaps:

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

Enable IPv4 packet forwarding (All Nodes)

Load the required kernel modules on all nodes:

# sysctl params required by setup, params persist across reboots
cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
net.ipv4.ip_forward = 1
EOF

# Apply sysctl params without reboot
sudo sysctl --system

Configure the critical kernel parameters for Kubernetes using the following:

sysctl net.ipv4.ip_forward

Install Container Runtime - Containerd (All Nodes)

We are using the containerd runtime. Install containerd and its dependencies with the following commands:

Enable the Docker repository:

Update the package list and install containerd:

Configure containerd to start using systemd as cgroup:

Check the containerd config:

Restart and enable the containerd service:

Add Apt Repository for Kubernetes (all nodes)

Update the apt package index, install kubelet, kubeadm and kubectl, and pin their version:

Last updated