Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Install K3s Server On Ubuntu 20.04

This tutorial shows you how to install K3s on a server to make it one of your "master" controller servers. This tutorial assumes you have followed the previous tutorials on setting up the database for Kubernetes, and have set up the load balancer.

I would recommend installing at least 3 of these "controller" servers. Initially I started with just 2 and it looked like they were "fighting" with 100% CPU utilization. Setting up 3 servers means there can be a consensus with 2 overriding a third.

System Resources

I gave these servers 1GB of RAM and 2 vCPUs. Rancher recommends at least 1GB.


First we need to export the variable for K3S to know how to connect to our database:



Then we can run the following command to install K3S (be sure to swap out the variable for the IP of your load balancer.


sudo curl -sfL | \
  sh -s - server \
  --node-taint CriticalAddonsOnly=true:NoExecute \
  --tls-san $LOAD_BALANCER_IP

After a few seconds, K3s will be installed and runnning.

Test It's Running

If you run the following command:

sudo k3s kubectl get node

... you should get a list of all the nodes in your cluster. For me this output the following after having installed on two servers:

NAME    STATUS   ROLES                  AGE     VERSION
kube2   NotReady   control-plane,master   49m   v1.21.1+k3s1
kube1   Ready      control-plane,master   51m   v1.21.1+k3s1
kube3   Ready      control-plane,master   18s   v1.21.1+k3s1
Last updated: 23rd June 2021
First published: 23rd June 2021