https://rancher.com/ logo
#rke2
Title
# rke2
s

sparse-fireman-14239

11/17/2022, 8:14 PM
Weird, if I add a taint in /etc/rancher/rke2/config.yaml to an already running node in a cluster, restart rke2-server then the taint is not applied.
Copy code
node-taint:
  - "CriticalAddonsOnly=true:NoExecute"
Though, kubelet is started with what I assume is the correct argument.
--register-with-taints=CriticalAddonsOnly=true:NoExecute
Adding the taint with kubectl works fine.
c

creamy-pencil-82913

11/17/2022, 8:15 PM
it’s called
--register-with-taints
. not
--add-taints-after-registered
the node is already registered, it’s not going to do anything
s

sparse-fireman-14239

11/17/2022, 8:15 PM
Ah ok, so I need to add it as an argument to kubelet instead of using node-taint in config.yaml?
c

creamy-pencil-82913

11/17/2022, 8:16 PM
no, after it’s registered you need to use kubectl to change the taints or labels
the kubelet options are just for setting things at the time it registers with the cluster
s

sparse-fireman-14239

11/17/2022, 8:16 PM
Got it, thanks for helping 🙂
c

creamy-pencil-82913

11/17/2022, 8:17 PM
https://docs.rke2.io/advanced/#node-labels-and-taints
RKE2 agents can be configured with the options
node-label
and
node-taint
which adds a label and taint to the kubelet. The two options only add labels and/or taints at registration time, and can only be added once and not removed after that through rke2 commands.
If you want to change node labels and taints after node registration you should use
kubectl
. Refer to the official Kubernetes documentation for details on how to add taints and node labels.
docs also cover this behavior
👍 1
s

sparse-fireman-14239

11/17/2022, 8:19 PM
Not sure how I missed that 😞
274 Views