Install Kubernetes on CentOS 85 min read


Kubernetes is a popular open-source container orchestration platform that allows you to deploy and manage multi-container applications at scale. Kubernetes can be used with a wide range of container systems among which Docker is the most used. For this reason, we will be looking at how to install docker first. Later In this article, we will learn how to install Kubernetes on CentOS 8.

Note: If you are using Ubuntu, then refer to our article How to install Kubernetes on Ubuntu 20.04.


  1. 2 or more Linux servers running CentOS8
  2. Access to a user account on each system with sudo or root privileges
  3. Your nodes should have at least two CPUs, each with at least 2GB of RAM. This isn’t a hard and fast rule, but it is essentially determined by the requirements of the application you’ll be running.
  4. All of your nodes should be able to communicate with one another, either via a private or public network, depending on what’s available.

Install Docker on CentOS 8

Before installing Kubernetes, we have to install Docker. Follow the below steps to install Docker.

1. Execute the below commands on both master and worker nodes

sudo su
dnf -y upgrade
swapoff -a
dnf config-manager --add-repo=
dnf install -y

2. Install docker

dnf install docker-ce --nobest -y

3. Start docker with the below command

systemctl start docker

4. Enable docker service with the below command so that the docker service starts as soon as you start your machine

systemctl enable docker

5. Check docker version and docker images with the below commands

docker version
docker images
docker version

We have successfully installed Docker. Now, we can proceed with installing Kubernetes.

Install Kubernetes on CentOS 8

Follow the below steps to install Kubernetes

1. Execute the below commands on both master and worker nodes

(copy-paste the below lines till EOF directly in the terminal)

cat <<EOF > /etc/yum.repos.d/kubernetes.repo
exclude=kubelet kubeadm kubectl
install kubernetes

2. Execute the below commands to install and start kubernetes service

dnf upgrade -y
dnf install -y kubelet kubeadm kubectl --disableexcludes=kubernetes
systemctl enable kubelet
systemctl start kubelet

3. Execute the below command only on master

kubeadm init --apiserver-advertise-address= --pod-network-cidr=

In the above command, change the –apiserver-advertise-address IP address as per your instance. The IP address should be the private IP of your instance. In my case, the private IP is

kubeadm init

The above command will generate kubeadm join command, copy that command because we will execute it later in the worker node.

4. Execute the below commands only on master 

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

5. Deploy a POD network to the cluster. A Pod Network is a way for various nodes in a cluster to communicate with one another. Here, we’re using a calico network. Execute the below command in the Master node,

kubectl apply -f

6. Go to the worker node and execute the kubeadm join command which you noted down earlier.

kubeadm join

7. Execute the below command on master to check the node status

kubectl get nodes
Tutorial on how to install kubernetes on centOS 8 - kubectl get nodes

Done. We have successfully installed Kubernetes on CentOS 8.

Note: If the nodes are not in READY state, then wait for some time and then execute the kubectl get nodes command again.


Leave a Reply