add notes to k3s server

Having issues with your DietPi installation or found a bug? Post it here.
Post Reply
stsch83
Posts: 4
Joined: Wed Aug 04, 2021 8:30 am

add notes to k3s server

Post by stsch83 »

Hello and good morning. I followed the guideline to add nodes to the k3s server but on both dietpi's i get the same out when i look for the nodes. It's only the server visible.

Guidline:
https://dietpi.com/docs/software/system_stats/#k3s

Code: Select all

ServerOutput:
root@dietpi113:~# kubectl get nodes
NAME        STATUS   ROLES                  AGE   VERSION
dietpi113   Ready    control-plane,master   54m   v1.21.3+k3s1

WorkerOutput:
root@dietpi114:~# kubectl get nodes
NAME        STATUS   ROLES                  AGE   VERSION
dietpi113   Ready    control-plane,master   54m   v1.21.3+k3s1
Can somebody tell what i'm doing wrong.

BR,
Stefan
User avatar
Joulinar
Posts: 5998
Joined: Sat Nov 16, 2019 12:49 am

Re: add notes to k3s server

Post by Joulinar »

@MichaIng
would this be something you could have a look on?
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
MichaIng
Site Admin
Posts: 3357
Joined: Sat Nov 18, 2017 6:21 pm

Re: add notes to k3s server

Post by MichaIng »

The issue which might be rated: https://github.com/MichaIng/DietPi/issues/4539

Prior to DietPi v7.4, when the hostname is changed (also via dietpi.txt), a reboot is required to really apply it system-wise to be picked up by K3s. Without a reboot done, when starting up K3s the first time, it still picks up the old hostname, respectively "dietpi", when installed automatically on first boot.

We fixed this in DietPi v7.4, but the images need to be redone to have this fix effective for first run installations.
petruf
Posts: 1
Joined: Sun Aug 08, 2021 9:29 pm

Re: add notes to k3s server

Post by petruf »

As Micha wrote, changing the hostname will be reflected in k3s configuration, once the DietPi images will be regenerated. This is why, the k3s configuration will be correct even from the beginning.

Please run the next steps, and let us know if k3s has the right configuration.
  • Reinstall k3s on the worker node
    Uninstall and then re-install k3s. The agent node will display the new name (e.g. dietpi114), when you run the command

    Code: Select all

    kubectl get nodes
  • Get the join key
    Get the node token from the server node (e.g. dietpi113)

    Code: Select all

    cat /var/lib/rancher/k3s/server/node-token
  • Add the server node
    Run next command on dietpi114, replacing {K3S_URL} with the address of the server node (e.g. http://[IP or hostname - dietpi113]:6443), and retrieved value of {K3S_TOKEN}

    Code: Select all

    k3s agent --server ${K3S_URL} --token ${K3S_TOKEN}
  • Verify the installation
    Retrieve the nodes, and you should see both of them displayed:

    Code: Select all

    kubectl get nodes
Post Reply