How to add custom metadata to nodes without restarting nomad?


It is possible to add custom labels to a node before running jobs so they can be used as constraints? Nomad documentation explains you can:

Now here is the problem: I see than the metadata is defined on the client section of the nomad configuration file (not the jobs):

client {
  enabled       = true
  network_speed = 500
  node_class    = "prod"

  meta {
    "owner" = "ops"
    "cached_binaries" = "redis,apache,nginx,jq,cypress,nodejs"
    "rack" = "rack-12-1"

So this means I need to hardcode this information then restart my nodes?
There is a way to update this information dynamically on the client without a reboot?

For the sake of argument, this is how you do it in Kubernetes using kubectl:

kubectl get nodes --namespace=default --show-labels
for node in; do
        case $node in
                        kubectl label nodes $node product="ProLiant-XXX-Gen666" --overwrite
                        kubectl label nodes $node fast_switch="yes" --overwrite
                        kubectl label nodes $node product="ProLiant-ZZZZ-Gen777" --overwrite
                        kubectl label nodes $node fast_switch="no" --overwrite
kubectl get nodes --namespace=default --show-labels

Please let me know if I misunderstood the way this works.


I’ve been having this same issue and haven’t found a solution