Skip to content
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

consul.address config doesn't interpolate GetInterfaceIP, or use CONSUL_HTTP_ADDR #11062

Closed
patmaddox opened this issue Aug 18, 2021 · 3 comments · Fixed by #12084
Closed

consul.address config doesn't interpolate GetInterfaceIP, or use CONSUL_HTTP_ADDR #11062

patmaddox opened this issue Aug 18, 2021 · 3 comments · Fixed by #12084
Labels
stage/accepted Confirmed, and intend to work on. No timeline committment though. theme/config type/enhancement

Comments

@patmaddox
Copy link

patmaddox commented Aug 18, 2021

Nomad version

Nomad v1.1.3 (8c0c814)

Operating system and Environment details

Ubuntu 20.04.2 LTS running on GCE

Issue

The consul stanza doesn't interpolate values for the address field. It also doesn't use CONSUL_HTTP_ADDR if you don't set the stanza.

Reproduction steps

Add this consul stanza to /etc/nomad.d/nomad.hcl:

consul {
  address = "{{ GetInterfaceIP \"tailscale0\" }}:8500"
}

Alternatively, set CONSUL_HTTP_ADDR to the correct value and omit the stanza.

Expected Result

Nomad sets the consul address to the IP address bound to the tailscale0 interface, e.g. 100.123.45.67:8500, or uses CONSUL_HTTP_ADDR if no address is set.

Actual Result

Nomad doesn't register with consul. There is a warning in the output:

2021-08-18T05:01:03.025Z [WARN]  client.alloc_runner.runner_hook.alloc_health_watcher: error looking up Consul registrations for allocation: alloc_id=169e6b69-cebd-cf52-df77-a4482d0254fe error="failed to retrieve services from consul: Get "http://%7B%7B%20GetInterfaceIP%20\"tailscale0\"%20%7D%7D:8500/v1/agent/services": dial tcp: lookup {>
Aug 18 05:15:08 nomad-server systemd[1]:

The relevant part being the non-interpolated value Get "http://%7B%7B%20GetInterfaceIP%20\"tailscale0\"%20%7D%7D:8500/v1/agent/services"

@patmaddox patmaddox changed the title consul.address config doesn't interpolate GetInterfaceIP consul.address config doesn't interpolate GetInterfaceIP, or use CONSUL_HTTP_ADDR Aug 18, 2021
@lgfa29 lgfa29 added stage/accepted Confirmed, and intend to work on. No timeline committment though. theme/config type/enhancement and removed type/bug labels Aug 19, 2021
@lgfa29 lgfa29 added this to Needs Triage in Nomad - Community Issues Triage via automation Aug 19, 2021
@lgfa29 lgfa29 self-assigned this Aug 19, 2021
@lgfa29
Copy link
Contributor

lgfa29 commented Aug 19, 2021

Thanks @patmaddox. I changed this to an enhancement since we don't actually support this yet, but sounds like a nice thing to have.

@lgfa29 lgfa29 moved this from Needs Triage to Needs Roadmapping in Nomad - Community Issues Triage Aug 19, 2021
@lgfa29 lgfa29 removed their assignment Aug 19, 2021
@rcoder rcoder removed this from Needs Roadmapping in Nomad - Community Issues Triage Sep 13, 2021
@vjanssens
Copy link

We're facing the same issue that we need to interpolate the consul address value as our consul client runs on 10.0.0.0. Unfortunately, this means we now have to remote-exec through terraform to set it per instance, as we also can't get CONSUL_HTTP_ADDR to work inside the systemd context.

Questions

  • How do others deal with this?
  • Can anyone point me in the right direction on how I can fix this myself?

@github-actions
Copy link

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.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
stage/accepted Confirmed, and intend to work on. No timeline committment though. theme/config type/enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants