My consul health check fails on nomad-client

When nomad auto registers it self, the nomad server passes all checks. However the nomad-client is failing its http check with this error.

HTTP GET http://0.0.0.0:4646/v1/agent/health?type=client: 500 Internal Server Error Output: {"client":{"ok":false,"message":"client not enabled"}}

I think it is because it is trying a 0.0.0.0 address and not 10.10.10.4. When i curl on the cli everthing is working just fine. I can’t figure out how to make nomad register the nomad -client with the right iP.

Brad

Hi @bradley :wave:

From the error message it seems like you don’t have the Nomad client set as enabled in your configuration file.

Could you double check your configuration file to see if you have a client block?

So here is what is crazy, it is enabled and I can do the check via curl and all is well. It seems to be the service registration is registering the ip of 0.0.0.0 which will not work. Here is the client config. I did try the flag “checks_use_advertise = true”. When I did this there was no output on the health check. Yes I know there is no TLS in this config. That is part of my config, first lets get it working :slight_smile:

data_dir   = "/etc/nomad.d/data"
datacenter = "miami"
bind_addr  = "0.0.0.0"

advertise {
  
  http  = "{{ GetInterfaceIP \"enp94s0f1\" }},127.0.0.1"
  rpc   = "{{ GetInterfaceIP \"enp94s0f1\" }},127.0.0.1"
  serf  = "{{ GetInterfaceIP \"enp94s0f1\" }}"
}

server {
  enabled = false
}

client {
  enabled = true
}

consul {
  address = "http://consul.service.miami.consul:8500"
  ssl     = false
}

vault {
  enabled = true
  address = "http://vault.service.miami.consul:8200"
}

The issue is due to the fact that I was advertising two address on http line. So you can only have one address, see below.

Doesn’t work:

advertise {
    http  = "{{ GetInterfaceIP \"enp94s0f1\" }},127.0.0.1"
  rpc   = "{{ GetInterfaceIP \"enp94s0f1\" }},127.0.0.1"
  serf  = "{{ GetInterfaceIP \"enp94s0f1\" }}"
}

The solution:

advertise {
    http  = "{{ GetInterfaceIP \"enp94s0f1\" }}"
  rpc   = "{{ GetInterfaceIP \"enp94s0f1\" }}"
  serf  = "{{ GetInterfaceIP \"enp94s0f1\" }}"
}