How to remove consul-connect-envoy-sidecar with prestop hook of de-registeration?

When connect-inject is true, consul adds a envoy sidecar container with prestop hook as to deregister the service. This service_id would have been registered with service name under init container.

In my case, the init container will register for below service and store them in service.hcl.

  1. <service_name>-sidecar-proxy
  2. service-name

And the sidecar container “consul-connect-envoy-sidecar”, uses the service.hcl to deregister above services.

When pod is killed, both the above services are deregistered. So, the service is not seen in consul till graceful shutdown of main container/application is killed.

Can we make consul either to avoid register of 2nd registration (the one with service name), which will be done by main container by application?


can we avoid consul not to deregister for the service with service_name alone (not the proxy sidecar)?