Hi. We are running a pretty old Rancher `v2.5.17`...
# general
q
Hi. We are running a pretty old Rancher
v2.5.17
and are aware that we need to upgrade it. Meanwhile, I'm trying to apply labels to my machines created by Rancher at Hetzner Cloud. But it doesn't work. 🧵 👇
We create our node template in Rancher using Terraform.
terraform plan
shows me that it wants to add the required configuration, eg.:
Copy code
...
          ~ server_labels       = {
              + "component" = "worker-pool"
              + "env"       = "stag"
              + "pool"      = "worker-pool-b"
            }
...
But it does not show up in the
hetznerConfig
section of the node template's API object in Rancher. I have already upgraded Hetzner Cloud Docker machine driver to `v3.6.0` which is supposed to support server labels. But I guess as long as they do not even show up in the node template there isn't much it can do.
b
Are these labels supposed to be getting populated in the /etc/rancher/rke2/config.yaml (on the nodes themselves) so that when the server or agent is run, it labels that way? If so, this is how the config.yaml is formatted for that (I'm including the EOF in case you are adding this to a user-data script): cat << EOF > /etc/rancher/rke/config.yaml node-label: - "node=<your-label>" node-taint: - "key=<your-taint>:NoSchedule" token: "<your-shared-token>" EOF
q
I want these labels to end up at the Hetzner cloud machines so that I can use them in other infrastructure components (eg. load balancers or firewalls) as selectors. These are not Kubernetes labels and selectors, that is a Hetzner cloud thing.
b
I'm not very familiar with the Hetzner cloud configuration... My method for deploying the cloud machines with labels is to use Autoscaling Groups with Launch Templates, and apply the labels that way. I'm not sure if this how yours are created, but figured I would share in case it helps:
Copy code
resource "aws_autoscaling_group" "<unique ASG name>" {

  <.... some other configuration fields... >
  
  launch_template {
    id 			= aws_launch_template.<template name>.id
	version 	= "$Latest"
	}

  tag {
    key 				= "Environment"
	value 				= "Dev"
	propagate_at_launch = "true"
	}
q
No, there is no ASG in Hetzner. Rancher assumes the role of an ASG there: it creates and re-creates and scales up and down individual machines using Rancher node templates.
👍 1