Setup k3s cluster for mini cluster :)
Hi guys, it’s been a while since I posted. Let me get straight to it, so yesterday I found another server orchestration framework bro besides k0sproject.io , there’s another one from the rancher product (cncf) which is said to be able to compete with k0s, but it’s still sandbox though… it’s okay maybe later it can enter incubation and graduate as a minimalist server orchestration :)
Okay let’s get straight to the important part which is prepare plan for clustering, so I want to create a regular cluster not HA which has 3 masters 3 workers, because it’s just for trying out this cncf project and I also setup on local VM, so… I will create 1 master 3 workers with the specs:
master : RAM 4GB, CPU 4
worker1 : RAM 2GB, CPU 2
worker2: RAM 2GB, CPU 2
worker3 : RAM 2GB, CPU 2
I use Ubuntu 20.04 LTS OS for all of them, Okay let’s get straight to the setup process,…
1. Master Setup
$ curl -sfL https://get.k3s.io | sh -
after the process is complete then the next step we take the auto generated node-token which is in the file /var/lib/rancher/k3s/server/node-token
$ sudo cat /var/lib/rancher/k3s/server/node-token
now please note that the generated result will be like this with the prefix xxxxxxxxxxxx::server:(INITOKEN)
now the INITOKEN part is the plain token that we will use to join the agent worker to the k3s master.. Okay, until here it can be understood, hopefully..
2. Worker Setup
the setup steps on the worker are very easy just paste the following command on each worker server then Boomzz.. the worker will be ready..
curl -sfL http:/get.k3s.io | K3S_URL=https://ip_server:6443 K3S_TOKEN=INITOKEN sh -
pay attention to ip_server and INITOKEN guys, adjust to your environment
- ip_server : is your master server ip
- INITOKEN : is the token that was generated in the first step
Okay, after all the setup on each worker is done, then the next step is checking.
3. Confirmation The Setup
Okay we go back to the master server terminal then login as root, then do the following command:
# k3s kubectl get nodes -o wide
the result will be more or less like this:

if the result is like the above then the cluster is ready to use,, yuhuuuu :D
Finally if you want to control the cluster from your local PC (which has kubectl installed), you can get the kubernetes config at /etc/rancher/k3s/k3s.yaml, then copy the contents of that file to the folder on our local located at ~/.kube/config, then edit the server : https://127.0.0.1:6443 part to https://ip_server_master:6443.
Done ! Good Luck :P