LivenessProbe is unhealthy but Kubernetes Health Check still success?

I try to make the pod unhealthy and show status in K8s UI.

Why the default Health Checks still passing in Consul UI?
Or how can I show the unhealthy status in Consul UI?

Below is my deployment yaml with a liveness probe.

    apiVersion: apps/v1
    kind: Deployment
    metadata:
    name: demo-deployment
    spec:
    selector:
        matchLabels:
        name: demo
    replicas: 1
    template:
        metadata:
        labels:
            name: demo
        spec:
        containers:
        - name: demo
            image: demo:v1
            ports:
            - containerPort: 8080
            livenessProbe:
            httpGet:
                path: /healthz
                port: 8080
            initialDelaySeconds: 1
            periodSeconds: 60

And deploy consul server by Helm Chart.

connectInject:
  enabled: true
  default: true

controller:`Preformatted text`
  enabled: true

transparentProxy:
  defaultEnabled: true

Thanks a lot!

Hey @chiyt27

We only sync the readiness status of the pod to Consul as described in these docs. This is also consistent with how Kubernetes shows status of your pod if your run kubectl get pods . When a liveness probe is failing, it’ll still show that your container status is running and that the containers are ready. You should also configure a readiness probe for your use case which will signal to both the Kubernetes cluster and the Consul service mesh when your application can receive traffic. This is consistent with how Kubernetes will route traffic to pods as well if you were just to deploy your applications without the mesh. Please see these docs on the purpose of each probe.

Thanks for your reply.
TTL health check mainly sync readiness status of K8s.

If I want to add another more probes and listed in Consul UI, I should to write the ‘Checks’ and import it through by -config-dir, right?

At the moment, we don’t allow you to specify custom checks for your service on the service mesh. We haven’t seen a use case when you’d need to do that. You can’t provide it via config-dir because the controller that auto-registers services on the service mesh will overwrite that.

If you need that as a feature, then could you create an issue in the hashicorp/consul-k8s repo and describe your use case?

Thanks for your reply again.

Oh…! If I want to registry my services and periodic check them
either using auto-inject sidecar with TTL health checks or registering services by hcl/json file that has customized checks
{
“service”: {
“name”: “xxx”,
“port”: ooo,
“check”: {
“http”: “http://localhost:ooo/health”,
“method”: “GET”,
“interval”: “1s”,
“timeout”: “1s”
},
“connect”: {
“sidecar_service”: {}
}
}
}