This message was deleted.
# general
a
This message was deleted.
c
That is an admin kubeconfig. Agents (or workers as you call them) do not get an admin kubeconfig, nor do they have a local apiserver. You need to get the admin kubeconfig off a server node.
There are other less privileged kubeconfigs available on workers under /var/lib/rancher/rke2/agent, if what you're doing does not require admin access.
a
I just want to add some labels to the worker node that just joined. So just enough access to run
kubectl label node_name label_name
I'm guessing that would need admin access though?
c
There are options (cli flags or config file keys) for doing that already? https://docs.rke2.io/advanced#node-labels-and-taints
a
Ah, cool thank you I'll take a look at that
the
node-label
is what I added to that config file you helped me with in
/etc/rancher/rke2/config.yaml.d
. That broke my worker registration process though. What I gathered from this was that you can't do that https://github.com/rancher/rke2/issues/3730
I added
Copy code
node-label: 
    - smarter-device-manager=enabled
    - node-type=compute
And then the worker wouldn't complete the registration process, it wouldn't get the actual
<http://node-role.kubernetes.io/worker|node-role.kubernetes.io/worker> : true
it needed from whatever does the initial agent registration process.
c
Are you trying to add it to the config file managed by rancher?
Don’t do that. Add your custom config to /etc/rancher/rke2/config.yaml, or a new file under /etc/rancher/rke2/config.yaml.d. That file created by the rancher system agent is managed by rancher, and is not meant to be edited.
or did you mean that you’re adding it to that other config file that you created earlier?
If the latter, then try:
Copy code
node-label+: 
    - smarter-device-manager=enabled
    - node-type=compute
to avoid replacing any labels set by rancher.
the + at the end of the key indicates that you want to merge that value with anythign set in other config files, instead of replacing it
a
Yes added it to that file. It must be because I didn't append, I didn't realize it would overwrite without the
+
a
That must be it then, thanks 🤦‍♂️
c
try that, I can’t think of what else might be causing problems
a
that's probably what it is. One other small thing, when the aws-cloud-controller deletes a dead node (ec2 instance was terminated) it removes it from the cluster just fine,
kubectl get nodes
doesn't show it anymore. But in the Cluster Management section in Rancher it shows that node still there in a Nodenotfound state and the cluster is stuck in Updating
c
yeah, if you don’t integrate Rancher into AWS as well I think it’ll get confused when the cluster members disappear out from under it. I don’t work on that side though, so other than using the Rancher AWS integrations I’m not sure what to suggest.
a
hmm... interesting I didn't think of Rancher itself needing to be integrated with AWS. I'll look into that. Thanks for the help again, have a good holiday weekend