Skip to content
This repository has been archived by the owner on Aug 25, 2021. It is now read-only.

how to add health check for synced service #131

Closed
webliupeng opened this issue Mar 11, 2019 · 4 comments
Closed

how to add health check for synced service #131

webliupeng opened this issue Mar 11, 2019 · 4 comments
Labels
duplicate This issue or pull request already exists question Further information is requested theme/health-checks About Consul health checking

Comments

@webliupeng
Copy link

webliupeng commented Mar 11, 2019

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:

  • how to add health check for this node?
  • why k8s-sync node ip address is 127.0.0.1.something wrong?
@peidong-hu
Copy link

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

@lkysow lkysow added the question Further information is requested label Sep 17, 2019
@lkysow lkysow added the theme/health-checks About Consul health checking label Oct 15, 2019
lkysow added a commit that referenced this issue Oct 31, 2019
For users that are setting up ACLs themselves (e.g. they have external
Consul servers so can't use bootstrapACLs) this allows them to create
their own Kubernetes auth method that the init container will use during
connect injection to receive an ACL token.

Fixes #131
@lkysow
Copy link
Member

lkysow commented Oct 31, 2019

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.

  • If NodePort then we register NodeIPs and node port. When your request reaches the node, the kube-proxy will ensure it's routed to a Pod that's healthy
  • If LoadBalancer then it's the same as above since after passing through the LoadBalancer you'll hit a NodePort
  • If ExternalIP then we route directly to it without health checking however Kubernetes doesn't do any health checking either
  • If ClusterIP then it's only routable via a kube-proxy which will take the health of services into account

@lkysow
Copy link
Member

lkysow commented Oct 31, 2019

I'm going to close this as a duplicate of hashicorp/consul-k8s#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!

@lkysow lkysow added the duplicate This issue or pull request already exists label Oct 31, 2019
@lkysow lkysow closed this as completed Oct 31, 2019
@webliupeng
Copy link
Author

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists question Further information is requested theme/health-checks About Consul health checking
Projects
None yet
Development

No branches or pull requests

3 participants