-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
address_mode=host uses consul address instead of nomad one #9177
Comments
The advertise/bind addresses for Consul and Nomad are for advertising and binding for Consul and Nomad's own HTTP, RPC, etc. so you're right that those won't change the advertised address of a Nomad task in Consul. That address is coming from fingerprinting the host. However, what you should be able to do is to use a Unfortunately it appears that the Example client configuration on a host with two IPs (10.0.2.15 and 10.199.0.200) client {
host_network "private" {
cidr = "10.199.0.200/24"
reserved_ports = "22"
}
} Example job: job "example" {
datacenters = ["dc1"]
group "cache" {
network {
port "db" {
to = 6379
host_network = "private"
}
}
service {
name = "redis"
# (unfortunately this doesn't work either way)
# address_mode = "host"
}
task "redis" {
driver = "docker"
config {
image = "redis:3.2"
ports = ["db"]
}
resources {
cpu = 500
memory = 256
}
}
}
} The results:
|
I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues. |
Nomad version
Nomad v0.12.5 (514b0d6)
Operating system and Environment details
debian 10 amd64
Issue
When using
address_mode="host"
inservice
stanza, and nomadbind_addr
/advertise_addr
is not the same as consul address, consul service is registered with consul'sbind_addr
/advertise_addr
but not nomad one.Don't know if this is a bug or a feature, but for now it seems there is no way to register service with nomad's ip address using
address_mode="host"
if consul address differs. Our case is registering 2 services for a task: withaddress_mode="driver"
(direct access to docker's IP) and withaddress_mode="host"
(access through proxy listening on the nomad IP; DNS name of the service is used for setting the rightHost
header)Reproduction steps
consul:
nomad:
job:
service1
will be registered usingipC
ip address.The text was updated successfully, but these errors were encountered: