How to install Kubernetes on Centos 8 (Redhat 8)

Install docker:

$dnf config-manager --add-repo=
$dnf install docker-ce --nobest -y
$systemctl start docker && systemctl enable docker

Disable Firewall:

$sudo systemctl stop firewalld && sudo systemctl disable firewalld

Install Kubernetes:

add new repository:

$sudo nano /etc/yum.repos.d/kubernetes.repo

 Install the necessary Kubernetes packages with the command:

$sudo dnf install -y kubelet kubeadm kubectl --disableexcludes=kubernetes

Start and enable the service with the command:

sudo systemctl enable --now kubelet

Configure iptables:

nano /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1

reload the new configuration with the command:

sysctl --system

Disable Swap:

We temporarily disable swap by command:

$sudo swapoff -a

To permanently disable swap (so it’s not re-enabled upon reboot), open the fstab for editing with the command:

$sudo nano /etc/fstab

comment out (add a # character at the beginning of a line) the line that begins with:


Create a Daemon File:

$nano /etc/docker/daemon.json
  "exec-opts": ["native.cgroupdriver=systemd"],
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "100m"
  "storage-driver": "overlay2",
  "storage-opts": [

Create a new systemd directory with the command:

$mkdir -p /etc/systemd/system/docker.service.d

Reload and restart the Docker daemon with the commands:

systemctl daemon-reload && systemctl restart docker

Initialize the Kubernetes Cluster

This is only done on the Kubernetes master. To initialize the cluster, issue the command:

$sudo kubeadm init

after that there should be information how to join this machine (node workder) to cluster by command

 $kubeadm join.....

we can check it by this command:

$kubectl get nodes 

for a single-machine Kubernetes cluster we need to enable scheduling Pods on the control-plane node, which is disabled by default.

$kubectl taint nodes --all

Deploying the Dashboard UI

official guide here.

$kubectl apply -f
Accessing the Dashboard UI

configuration for outside accessing is here.

checking the deployed status:

$kubectl get pods --all-namespaces
$kubectl describe pod NAME

Leave a Reply

Close Menu