Kubernetes is a powerful container orchestration tool that helps manage containerized applications in a clustered environment. In this guide, we will walk you through the installation of a Kubernetes cluster using Kubeadm on Rocky Linux. Whether you are deploying it on a local server or using a Windows VPS UK, this tutorial provides all the necessary steps.
Step 1: Update Your System
Before installing Kubernetes, ensure your system is up to date. Run the following commands:
sudo dnf update -y
Keeping your system updated is crucial for security and performance, whether you're setting it up locally or on a VPS Windows Servers platform.
Step 2: Install Required Packages
Install required packages and dependencies for Kubernetes:
sudo dnf install -y curl wget vim net-tools
Step 3: Disable Swap
Kubernetes requires swap to be disabled. Disable it using the following command:
sudo swapoff -a
To make this change permanent, edit the /etc/fstab
file and comment out any swap entries:
sudo vim /etc/fstab
Step 4: Add Kubernetes Repository
Add the Kubernetes YUM repository to your system:
cat <
Step 5: Install Kubeadm, Kubelet, and Kubectl
Install Kubeadm, Kubelet, and Kubectl using the following command:
sudo dnf install -y kubelet kubeadm kubectl
Enable and start the Kubelet service:
sudo systemctl enable kubelet
sudo systemctl start kubelet
Step 6: Initialize the Kubernetes Cluster
To initialize the Kubernetes master node, run the following command:
sudo kubeadm init --pod-network-cidr=192.168.0.0/16
After the initialization is complete, you will see instructions to set up your kubeconfig file. Run the following command to set up your configuration:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
Step 7: Install a Pod Network Add-on
You need to install a network add-on to allow communication between the pods. For example, to install Calico, run the following command:
kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml
Step 8: Join Worker Nodes to the Cluster
If you have additional nodes to join to the cluster, you will need to run the command provided at the end of the `kubeadm init` output on each worker node. It will look something like this:
kubeadm join :6443 --token --discovery-token-ca-cert-hash sha256:
Step 9: Verify the Cluster
To check the status of your Kubernetes cluster, use the following command:
kubectl get nodes
You should see your master and any joined worker nodes listed as "Ready."