Can I get some help regard #cloud config

I’m looking a basic setup for launching hosts using the AWS userdata field on autoscaling groups. I have the following

#cloud-config
rancher:
  services:
    register:
      privileged: true
      volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      image: rancher/agent:v0.8.2
      labels:
        environment=prod
        availability=stable
      command:
      - https://mydomain.com/v1/scripts/IPSUMLETTERSHASH?ISthisAkeyIshouldntSHAREheh

Anyway the labels on the host itself don’t appear, and maybe every other host actually registers itself with my host. They all have network access and if I manually ssh into the ones that don’t successfully register I can manually execute the docker rancher/agent code. Any suggestions?

When adding a host and host labels, the host label is actually added an as environment variable.

The docker command would be something like this, which I found by going to “Add Host” -> “Custom” and just added the host labels that you showed.

sudo docker run -e CATTLE_HOST_LABELS='environment=prod&availability=stable' -d --privileged -v /var/run/docker.sock:/var/run/docker.sock rancher/agent:v0.8.2 https://mydomain.com/v1/scripts/IPSUMLETTERSHASH?ISthisAkeyIshouldntSHAREheh

So the cloud-config equivalent would be:

#cloud-config
rancher:
  services:
    register:
      privileged: true
      volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      image: rancher/agent:v0.8.2
      environment:
        - CATTLE_HOST_LABELS='environment=prod&availability=stable'
      command:
      - https://mydomain.com/v1/scripts/IPSUMLETTERSHASH?ISthisAkeyIshouldntSHAREheh
1 Like