add notes to k3s server

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

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

MichaIng
would this be something you could have a look on?

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.

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
kubectl get nodes



  • Get the join key
    Get the node token from the server node (e.g. dietpi113)
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}
k3s agent --server ${K3S_URL} --token ${K3S_TOKEN}



  • Verify the installation
    Retrieve the nodes, and you should see both of them displayed:
kubectl get nodes

I am sorry for digging out this old threads, but I am really frustrated for getting the cluster to work.
I hope you could shade some light on where should I investigate since googling yeild no result for my error :frowning:

I’ve installed dietpi and K3s in my four nanopi fire 3 sbc after hostname were set.
then I copy the yaml files from server node to agent nodes, get the token from server node and then execute k3s agent --server ${K3S_URL} --token ${K3S_TOKEN} at each of the agent nodes, all bounced back with an error showing :-


Incorrect Usage: flag provided but not defined: -apiVersion

NAME:
   k3s agent - Run node agent

USAGE:
   k3s agent [OPTIONS]

OPTIONS:
   --config FILE, -c FILE                     (config) Load configuration from FILE (default: "/etc/rancher/k3s/config.yaml") [$K3S_CONFIG_FILE]
   --debug                                    (logging) Turn on debug logs [$K3S_DEBUG]
   -v value                                   (logging) Number for the log level verbosity (default: 0)
   --vmodule value                            (logging) Comma-separated list of FILE_PATTERN=LOG_LEVEL settings for file-filtered logging
   --log value, -l value                      (logging) Log to file
   --alsologtostderr                          (logging) Log to standard error as well as file (if set)
   --token value, -t value                    (cluster) Token to use for authentication [$K3S_TOKEN]
   --token-file value                         (cluster) Token file to use for authentication [$K3S_TOKEN_FILE]
   --server value, -s value                   (cluster) Server to connect to [$K3S_URL]
   --data-dir value, -d value                 (agent/data) Folder to hold state (default: "/var/lib/rancher/k3s")
   --node-name value                          (agent/node) Node name [$K3S_NODE_NAME]
   --with-node-id                             (agent/node) Append id to node name
   --node-label value                         (agent/node) Registering and starting kubelet with set of labels
   --node-taint value                         (agent/node) Registering kubelet with set of taints
   --image-credential-provider-bin-dir value  (agent/node) The path to the directory where credential provider plugin binaries are located (default: "/var/lib/rancher/credentialprovider/bin")
   --image-credential-provider-config value   (agent/node) The path to the credential provider plugin config file (default: "/var/lib/rancher/credentialprovider/config.yaml")
   --selinux                                  (agent/node) Enable SELinux in containerd [$K3S_SELINUX]
   --lb-server-port value                     (agent/node) Local port for supervisor client load-balancer. If the supervisor and apiserver are not colocated an additional port 1 less than this port will also be used for the apiserver client load-balancer. (default: 6444) [$K3S_LB_SERVER_PORT]
   --protect-kernel-defaults                  (agent/node) Kernel tuning behavior. If set, error if kernel tunables are different than kubelet defaults.
   --container-runtime-endpoint value         (agent/runtime) Disable embedded containerd and use the CRI socket at the given path; when used with --docker this sets the docker socket path
   --default-runtime value                    (agent/runtime) Set the default runtime in containerd
   --image-service-endpoint value             (agent/runtime) Disable embedded containerd image service and use remote image service socket at the given path. If not specified, defaults to --container-runtime-endpoint.
   --pause-image value                        (agent/runtime) Customized pause image for containerd or docker sandbox (default: "rancher/mirrored-pause:3.6")
   --snapshotter value                        (agent/runtime) Override default containerd snapshotter (default: "overlayfs")
   --private-registry value                   (agent/runtime) Private registry configuration file (default: "/etc/rancher/k3s/registries.yaml")
   --disable-default-registry-endpoint        (agent/containerd) Disables containerd's fallback default registry endpoint when a mirror is configured for that registry
   --node-ip value, -i value                  (agent/networking) IPv4/IPv6 addresses to advertise for node
   --node-external-ip value                   (agent/networking) IPv4/IPv6 external IP addresses to advertise for node
   --resolv-conf value                        (agent/networking) Kubelet resolv.conf file [$K3S_RESOLV_CONF]
   --flannel-iface value                      (agent/networking) Override default flannel interface
   --flannel-conf value                       (agent/networking) Override default flannel config file
   --flannel-cni-conf value                   (agent/networking) Override default flannel cni config file
   --kubelet-arg value                        (agent/flags) Customized flag for kubelet process
   --kube-proxy-arg value                     (agent/flags) Customized flag for kube-proxy process
   --rootless                                 (experimental) Run rootless
   --prefer-bundled-bin                       (experimental) Prefer bundled userspace binaries over host binaries
   --docker                                   (agent/runtime) (experimental) Use cri-dockerd instead of containerd
   --vpn-auth value                           (agent/networking) (experimental) Credentials for the VPN provider. It must include the provider name and join key in the format name=<vpn-provider>,joinKey=<key>[,controlServerURL=<url>][,extraArgs=<args>] [$K3S_VPN_AUTH]
   --vpn-auth-file value                      (agent/networking) (experimental) File containing credentials for the VPN provider. It must include the provider name and join key in the format name=<vpn-provider>,joinKey=<key>[,controlServerURL=<url>][,extraArgs=<args>] [$K3S_VPN_AUTH_FILE]
   --disable-apiserver-lb                     (agent/networking) (experimental) Disable the agent's client-side load-balancer and connect directly to the configured server address

FATA[0000] flag provided but not defined: -apiVersion

It seems -apiVersion is from the k3s.yaml / config.yaml
Is there anything I’ve missed apart from the doc on dietpi and the command from this thread?

Any help is appreciated!