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 TCP Checks Should Default to Bind Addr #4053

Open
alkalinecoffee opened this issue Apr 20, 2018 · 2 comments
Open

Consul TCP Checks Should Default to Bind Addr #4053

alkalinecoffee opened this issue Apr 20, 2018 · 2 comments
Labels
theme/health-checks Health Check functionality type/enhancement Proposed improvement or new feature

Comments

@alkalinecoffee
Copy link

alkalinecoffee commented Apr 20, 2018

Looking at the documentation for service configs, this part has me a bit confused:

For a service definition:

The address field can be used to specify a service-specific IP address. By default, the IP address of the agent is used, and this does not need to be provided. The port field can be used as well to make a service-oriented architecture simpler to configure; this way, the address and port of a service can be discovered.

And for a TCP health check definition:

TCP + Interval - These checks make an TCP connection attempt every Interval (e.g. every 30 seconds) to the specified IP/hostname and port. If no hostname is specified, it defaults to "localhost".

It seems to me that the service's bind address should be honored as the default for all child healthcheck definitions for that service, instead of switching over to localhost. Otherwise, in the current scenario, there is no way to set up a TCP healthcheck for a service that listens only on the bind address without knowing the node's external IP in the first place.

This suggestion may be a backwards incompatible change, but it seems to be more in line with the service-to-health-check relationship.

If this is not an option, then a workaround like GetInteraceIP should perhaps be made available in the healthcheck definition as it is through command-line arguments so users can dynamically specify the target IP to a non-loopback address. Making envvars available to be injected similarly might also work, and be more flexible.

@drawks
Copy link
Contributor

drawks commented May 16, 2018

Making the service address and port available when defining checks would be great. I'd propose this be extended generally and not just to TCP checks:

  • address and port should be made available as environment variables in script checks and some sort of macros in other checks
  • http/https checks should be able to take a relative url where the implicit host/port pair is derived from the bound service
  • grpc and tcp checks should default to the port/address of the bound service

@pearkes pearkes added type/enhancement Proposed improvement or new feature theme/health-checks Health Check functionality labels Jul 24, 2018
@Blefish
Copy link

Blefish commented Sep 6, 2024

For members with dynamic IP, Consul properly reregisters itself to the cluster, however, services created manually, that have this tcp health check in place and use ip:port to register them originally, will be no longer passing health check.

Any way around this, after whole six years? Does http check require address or can it be set to just path?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme/health-checks Health Check functionality type/enhancement Proposed improvement or new feature
Projects
None yet
Development

No branches or pull requests

4 participants