Closed webliupeng closed 5 years ago
got same question, all the synced services from k8s to consul have no health check
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:
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.
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 healthyLoadBalancer
then it's the same as above since after passing through the LoadBalancer you'll hit a NodePortExternalIP
then we route directly to it without health checking however Kubernetes doesn't do any health checking eitherClusterIP
then it's only routable via a kube-proxy which will take the health of services into accountI'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!
Thanks for your answer. It's very clear. @lkysow
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: