Nomad: 1.2.6 (install by ansible community role)
Consul: 1.11.3 (install by ansible community role)
Consul Connect enable
I would like to register my consul port 8500 as consul service for service mesh
I have an app needs to access to consul on port 8500. But this app is in consul connect ring.
In my nomad job network is in mode “bridge” . But when I try to curl consul services in container, I cannot…
@fred-gb The example I shared above stated that the assumption is that you have a local Consul client running. It doesn’t appear that a Consul client is running in your alpine container examples.
But if we take a step back, what is the overall objective you are trying to achieve? I’m still not quite sure what you are trying to do.
I had a similar use case and I solved for it by configuring Consul’s HTTP server to listen on the docker0 interface.
# Ansible group_vars for `consul_instances` group
consul_addresses_http: "127.0.0.1 ::1 {{ ansible_docker0.ipv4.address }}"
I then configured the tasks within my Nomad jobs (in my case, Fabio and Traefik) to connect to that IP address when accessing Consul’s HTTP API.
# Fabio environment variable for setting Consul HTTP Address
FABIO_registry_consul_addr = "172.17.0.1:8500"
# Traefik environment variable for setting Consul HTTP Address
TRAEFIK_PROVIDERS_CONSULCATALOG_ENDPOINT_ADDRESS = "172.17.0.1:8500"
In my opinion this isn’t the best solution since it relies on statically configuring an IP address in various configuration/job files. However, it did enable my Nomad task that was using the bridge networking mode to access Consul’s HTTP API, and allowed me to avoid exposing the Consul HTTP server on an address that was routable from other hosts on the network.