In this blog, We will see step-by-step of k3s installation in Centos 8.

K3s, It is a lightweight Kubernetes container service which is created by Rancher and it is a simplified version of K8s with less than 100MB of binary size. It uses sqlite3 as a backend storage and etcd3, MySQL, Postgres database options are available. It is secured by default with standard practices.


Linux servers: 2

OS: Centos 8.5

Step 1: Update OS and install Kubectl

Here am using one master and node to do the installation.

Master: (

Worker Node: (

Go to each server and run "yum update" to get the latest packages and do a reboot.

Make sure a firewall is enabled between these two Linux servers.

Install Kubectl,

Go to the root path of the master node and run the below commands,

curl -LO

chmod +x kubectl

cp kubectl /usr/bin

check the kubectl version to make sure the command is working or not,

kubectl version --short

Go to the Master and worker nodes and make sure the host file is updated with the below details if the DNS is not resolving. 

Step 2: Install K3s in the Master server

Use below command in master server to install k3s,

curl -sfL | sh -

Once successfully installed, you can run below to check the k3s service status,

systemctl status k3s

We can see the k3s config file in the below path in Master,

cat /etc/rancher/k3s/k3s.yaml

Next, we need to copy the config file to use in kubectl.

mkdir ~/.kube

cp /etc/rancher/k3s/k3s.yaml ~/.kube/config

Then check,

kubectl get nodes

K3s master node is successfully installed. next will do the worker node installation.

Step 3 : Install k3s agent in WorkerNode

Go to the worker node and execute the below command,

curl -sfL | K3S_URL=${k3s_Master_url} K3S_TOKEN=${k3s_master_token} sh -

k3s_Master_url =

k3s_master_token= "Get the token from the master by executing the below command"
cat /var/lib/rancher/k3s/server/node-token 

Once the installation is successful, we can check the k3s agent status by executing the below command,

systemctl status k3s-agent.service

Step 4: K3s Installation validation

Go to the master node and check new worker node is listed or not by the below command,

kubectl get nodes

Great!, worker node is attached successfully with the k3s master.

Step 5: Deploy the Nginx webserver in K3s and validate,

Am using helm chart installation for this purpose. 

Helm install,

curl | bash

cp -r /usr/local/bin/helm /usr/bin/helm

Add Bitnami repo in Helm,

helm repo add bitnami

Deploy Nginx webserver by using below helm command,

helm install nginx-web bitnami/nginx

Check the pod status,

kubectl get pods -o wide

The Nginx pod is running fine now.

Access Nginx webserver,

I took the clusterIP of the Nginx service and tried to access it, and it's working.

That's all, K3s is successfully in centos 8.5 and deployed Nginx webserver and validated.

Post a Comment

Previous Post Next Post