Consul-k8s - not deregistering synced services from consul

Hi,
My case:
k8s running on Azure (AKS) - created with terraform,
Consul cluster external to k8s,
consul-k8s deployment (not helm chart, without installing any consul agent or server on the k8s side),
properly annotated k8s services are synchronized to consul (default synchronization set to false)

Everything works as expected, but there is a catch in case of terraform destroy on k8s cluster - services are left on consul and because they are external services - no healthcheck is possible so consul continue to serve their addresses in service discovery as healthy.

My question:
Is there any way to automatically deregister services from consul in case the k8s cluster is “terraform destroyed” ?

Regards and you all at HashiCorp keep doing the great work :slight_smile:

Hi bondido,
Unfortunately there is no automated way to deregister the services right now. You will need to use the /catalog/deregister api (https://www.consul.io/api-docs/catalog#deregister-entity).

There is an open issue for health checks that you could follow: https://github.com/hashicorp/consul-k8s/issues/29