hashicorp / consul-helm

Helm chart to install Consul and other associated components.
Mozilla Public License 2.0
419 stars 386 forks source link

how to add health check for synced service #131

Closed webliupeng closed 5 years ago

webliupeng commented 5 years ago

I'm new to consul. I have installed consul in k8s(version:1.10) with helm chart(master branch) . enabled catalog sync . There is no any healthy service. And all synced services in a same node, name is k8s-sync, the node no any health check. ip address is 127.0.0.1

My questions are:

peidong-hu commented 5 years ago

got same question, all the synced services from k8s to consul have no health check

lkysow commented 5 years ago

Hi @webliupeng I'll try to answer your questions one by one.

There is no any healthy service.

There should be services synced into Consul from Kubernetes: image

They don't have any health checks so they shouldn't be unhealthy. Can you explain further what you mean by this?


And all synced services in a same node, name is k8s-sync, the node no any health check.

The sync works differently than the way services are usually registered into Consul. The way we sync services we don't end up syncing each individual Pod to Consul. Since each instance of a service doesn't necessarily correspond to a Node we create a "fake" node called k8s-sync to register the services on. This node has no health checks because it's not a real node.


ip address is 127.0.0.1

Because k8s-sync is not a real node, we just make up an IP for it. This IP isn't used for anything because each service has its own IP.


Regarding health checks in general. Currently there's no way to add health checks to the service that's synced from Kubernetes. Kubernetes health checking will still work to ensure you're not routing to unhealthy services, however you currently can't view the service status in Consul.

lkysow commented 5 years ago

I'm going to close this as a duplicate of https://github.com/hashicorp/consul-k8s/issues/29 where we'll be tracking the ability to add health checks to synced services.

If you have any more questions let us know. Thanks!

webliupeng commented 5 years ago

Thanks for your answer. It's very clear. @lkysow