How To Install Kubernetes on CentOS 8 (Easy Way) + Docker.

This is the simplest way of installing Kubernetes on CentOS 8.
Rancher is an awesome company that makes auto-installers among other software.

They have something called k3s which sets you up, ready for containers.

yum update -y
yum install -y container-selinux selinux-policy-base
rpm -i https://rpm.rancher.io/k3s-selinux-0.1.1-rc1.el7.noarch.rpm
curl -sfL https://get.k3s.io | sh -
# takes maybe 30 seconds
kubectl get node

Here’s your node.

[[email protected] module]# kubectl get node
# NAME                       STATUS   ROLES    AGE     VERSION
# centos-8cpu-32gb-sg-sin1   Ready    master   2m20s   v1.18.2+k3s1

Connect it to your master, or keep it as agent.

sudo k3s server & 
# Kubeconfig is written to /etc/rancher/k3s/k3s.yaml
sudo k3s kubectl get node

# On a different node run the below. NODE_TOKEN comes from /var/lib/rancher/k3s/server/node-token
# on your server
sudo k3s agent --server https://myserver:6443 --token ${NODE_TOKEN}

Install Docker if you want:

dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
DOCKERVERSION=$(dnf list docker-ce --showduplicates | \
sort -r | \
grep "docker-ce.x86_64" -m1 | \
sed -e 's/docker\-ce\.x86\_64//g' -e 's/docker\-ce\-stable//g' | \
tr -d [:space:])
dnf install --nobest docker-ce -y

	

Leave a Reply

Your email address will not be published. Required fields are marked *