Kubernetes readiness/liveness probe in console app Kubernetes readiness/liveness probe in console app kubernetes kubernetes

Kubernetes readiness/liveness probe in console app


Readiness probe makes zero sense for this scenario as you will not direct any traffic via means of Service. As your app reads rabbitmq on it's own, it will do so regardless of kube probes. There is logic though in using liveness probe where you might want to restart container if the process inside has failed in some way.

You can either create a status api endpoint which will listen on some port for http requests and respond with 200 OK if your application is healthy (you need some logic inside to define what healthy means) or use command based probe to launch a command that will do some checking and report if container is ok or not.


In this case, it may be better to create a sidecar container in the same pod. This container would host an ASP.NET Core site, specifically to leverage the new health checks api recently introduced in .NET Core 2.2. There are extensions for monitoring rabbitmq connectivity. You would then expose the ASP.NET Core website for health checks.

ASP.NET Core Health Montioring

AspNetCore.HealthChecks.Rabbitmq


Here are some nice solutions to add health check to non-asp application (console application for example):

Performing a health check in .NET Core Worker Service

I would suggest to implement the TCP solution, as it is minimal but still gives the expected result.