0

I have a setup with nomad and consul on my machine.
I start a service with a nomad job and have it registered successfully.
My issue is on IP resolutions:
- in Nomad UI, I can see the IP 10.0.75.1
- in Consul UI, in service discovery, I can see the IP 10.0.75.1
- in consul healthcheck, the IP used is a different one 172.31.194.209

Both IP are good host IPs, but my problem is the service only answer on 10.0.75.1.

My point is not really trying to have that service working as I could workaround the issue by putting a different configuration for it to answer on 171.31.194.209 too.

What I'd like is to understand is how the consul healthcheck resolves its host IP and in my case to a different one than the Nomad/Consul-UIs. Also a way to force that resolution would be great.

Note that the Healthcheck is setup by Nomad with network_mode = host

Some configurations:
CONSUL

{
  "ui":  true,
  "data_dir":  "C:\\Users\\foo\\consul\\data",
  "client_addr":  "10.0.75.1",
  "node_name":  "foonode",
  "server":  true,
  "bind_addr":  "10.0.75.1",
  "ports":  {
              "http":  8500
          },
  "bootstrap":  true,
  "bootstrap_expect":  1,
  "datacenter":  "local",
  "node_meta":  {
                  "user":  "foo"
              }
}

NOMAD

name = "foonode"
bind_addr = "10.0.75.1"
datacenter = "local"
data_dir = "C:\\Users\\foo\\nomad\\data"
server {
    enabled = true
    bootstrap_expect = 1
}
client {
    enabled = true
    options {
        "driver.raw_exec.enable" = "1"
    }
    meta {
        user = "foo"
    }
}
consul {
    address = "http://10.0.75.1:8500"
}
Thibault Deheurles
  • 1,211
  • 13
  • 21
  • Consul uses the IP address assigned to that container by Docker, you'll find it in the environment of your running container in the `NOMAD_IP_foo` variable, where `foo` is the name you assigned to the port of the task. – Joachim de Groot Mar 03 '18 at 02:07

1 Answers1

0

Just guessing, but your machine has multiple ip addresses. One of them is the 171 address. Would an "advertise_addr": "10.0.75.1" added to your consul.json configuration help?

Greg
  • 6,571
  • 2
  • 27
  • 39