https://rancher.com/ logo
Title
l

limited-eye-27484

07/15/2022, 7:35 PM
is it possible to register a new node against an RKE cluster and apply a node label as part of the registration?
Does the
-e CATTLE_HOST_LABELS='my/label=setting'
still work with Rancher 2.x? I see it mentioned in the Rancher 1.x docs
t

tall-school-18125

07/15/2022, 10:55 PM
In RKE you would update the cluster.yml file and run
rke up
. In the cluster.yml you can add an arbitrary map of labels for each node.
l

limited-eye-27484

07/15/2022, 10:58 PM
What about from a cluster registration command?
sudo docker run -d --privileged --restart=unless-stopped --net=host -v /etc/kubernetes:/etc/kubernetes -v /var/run:/var/run  rancher/rancher-agent:v2.6.2 --server <https://my.rancher.domain> -e CATTLE_HOST_LABELS='my/label=setting' --token nope --worker
I haven’t tried it yet, just curious
t

tall-school-18125

07/15/2022, 11:03 PM
I've never seen a registration command for RKE1. Is this for RKE1 or RKE2?
l

limited-eye-27484

07/15/2022, 11:04 PM
2
t

tall-school-18125

07/15/2022, 11:05 PM
yes, it looks like you should be able to pass a
--node-label
option https://docs.rke2.io/install/install_options/linux_agent_config/
l

limited-eye-27484

07/15/2022, 11:05 PM
oh
shoot
my bad It’s RKE1
I totally forgot about the Rancher vs RKE distinction >_<
t

tall-school-18125

07/15/2022, 11:07 PM
Ah, I see. So what we are really looking for is an option for the rancher agent.
In that case, yes - you can use
CATTLE_NODE_LABEL
or
--label
and for multiple labels pass the option more than once. other options are here https://rancher.com/docs/rancher/v2.6/en/cluster-provisioning/rke-clusters/custom-nodes/agent-options/
l

limited-eye-27484

07/15/2022, 11:08 PM
Well there it is right in the documentation 🤦
TY much!!
t

tall-school-18125

07/15/2022, 11:09 PM
you're welcome!