Consul Health Check Port Selection

107 views
Skip to first unread message

Brendan Munro

unread,
Jul 7, 2016, 3:52:53 PM7/7/16
to Nomad
We've recently ran into an issue integrating consul with our applications. Specifically, we run our health checks on a separate port from our RPC. With the implementation of health checks in Nomad, we can't specify the port to listen for the health check on as separate from our RPC port, it has to use the exact port of the service. Is there any way we can work around this outside of merging the two together?

Diptanu Choudhury

unread,
Jul 7, 2016, 7:01:06 PM7/7/16
to Brendan Munro, Nomad
Hi Brendan,

You can reference any of the ports you have asked for in Consul health checks. For example,

If I have a Task with two ports, one admin and the other rpc, I can make Nomad tell consul to do tcp aliveness check on the admin port.

task {

port "rpc" {}
port "admin" {}

service {
  name = "foo"
  port = "admin"
  check {
    type = "tcp"
  }
}

On Thu, Jul 7, 2016 at 12:52 PM, Brendan Munro <bre...@myecofit.com> wrote:
We've recently ran into an issue integrating consul with our applications. Specifically, we run our health checks on a separate port from our RPC. With the implementation of health checks in Nomad, we can't specify the port to listen for the health check on as separate from our RPC port, it has to use the exact port of the service. Is there any way we can work around this outside of merging the two together?

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/nomad/issues
IRC: #nomad-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Nomad" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nomad-tool+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nomad-tool/ee113796-44ae-415b-836a-295a72c76d35%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Thanks,
Diptanu Choudhury

Brendan Munro

unread,
Jul 8, 2016, 12:14:24 AM7/8/16
to Nomad
Hi Diptanu,

Thanks for replying so quickly! In this scenario, would the service be registered to Consul under the admin port, or the rpc port? When we work directly with Consul outside of Nomad, our result would be a check directed to localhost:{admin port}, while the service would be registered with the appropriate host/port combination to access the RPC binding. This allows us to have a simple HTTP handler for health checks, while our RPC port can be whatever is required by the service.

At the moment, this isn't a breaking issue for us (we've temporarily moved our health checks onto our http bound services rpc ports), but I am curious if this approach is possible within Nomad. 

Diptanu Choudhury

unread,
Jul 8, 2016, 2:08:32 PM7/8/16
to Brendan Munro, Nomad
Hi Brendan,

I see, in this case Nomad will register the admin port with Consul. Perhaps we should allow users to specify a different port with checks than what is specified in the service.


For more options, visit https://groups.google.com/d/optout.

Brendan Munro

unread,
Jul 8, 2016, 3:21:35 PM7/8/16
to Nomad
I could definitely see a use case for this scenario, though for us at the moment it is presenting a major problem.

Diptanu Choudhury

unread,
Jul 8, 2016, 3:34:05 PM7/8/16
to Brendan Munro, Nomad
I am working on a PR, for this since others have asked for the same. It should be out soon. 

Sent from my iPhone

Diptanu Choudhury

unread,
Jul 8, 2016, 8:22:06 PM7/8/16
to Brendan Munro, Nomad
This has landed in master, and will go out with the 0.4.1 release.

Brendan Munro

unread,
Jul 15, 2016, 1:56:58 PM7/15/16
to Nomad
Thanks Diptanu! That's going to save one of my developers a headache in the near future I think.
Reply all
Reply to author
Forward
0 new messages