Kubernetes readiness/liveness probe in console app

12/17/2017

I have a console app in .net core. How to implement Kubernetes readiness/liveness probe?

My app process rabbitmq messages in loop, and don`t listen any http ports.

-- RouR
.net
console-application
kubernetes
probe

2 Answers

12/17/2017

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.

-- Radek 'Goblin' Pieczonka
Source: StackOverflow

5/6/2019

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

-- rifferte
Source: StackOverflow