How should I healthcheck an event-driven service

7/22/2021

Suppose I have a service which rather than listening for http request, or gRPC procedure calls only consumes messages from a broker (Kafka, rabbitMQ, Google Pub/Sub, what have you). How should I go about healthchecking the service (eg. k8s liveness and readyness probes) ?

Should the service also listen for http solely for the purpose of healthchecking or is there some other technique which can be used ?

-- Pedro Nascimento
asynchronous
event-driven
health-check
kubernetes
microservices

2 Answers

7/22/2021

Having the service listen to HTTP solely to expose a liveness/readiness check (although in services that pull input from a message broker, readiness isn't necessarily something that a container scheduler like k8s would be concerned with) isn't really a problem (and it also opens up the potential to expose diagnostic and control endpoints).

-- Levi Ramsey
Source: StackOverflow

7/22/2021

Kubernetes supports three different types of probes, see also Kubernetes docs:

  • Running a command
  • Making an HTTP request
  • Checking a TCP socket

So, in your case you can run a command that fails when your service is unhealthy.

Also be aware that liveness probes may be dangerous to use.

-- derkoe
Source: StackOverflow