We're in the process of moving everything to K8s and one of our applications is a small .NET Core 2.2 console app that runs a Hangfire background job server. At the moment the app runs as a Windows service, but that's obviously about to change.

The problem that I ran into is that I'm not sure which approach is better for the K8s liveness probe:

  1. Use an ASP.NET Core web app and use the built-in health check system
  2. Stick to the console app approach and run some script to check the app still works

The only things that I think we need to check is if the process is up and if the app can connect to the Hangfire db. Doing this with the first approach is extremely easy, but I'm not sure it's worth creating a web app just for this. The second approach would result in a lighter app, but I honestly have no idea how we would end up checking the db connection.

Has anyone tackled this issue before? Is there some other approach that would be more appropiate? Any suggestion is appreciated.


Windows services are managed by Service Control Manager. This can be queried, even remotely, using WMI. Most people would probably use a system management software like Nagios. There clearly is an impedance mismatch with kubernetes and the idea of a liveliness query.

You could run a web server from inside the console app. See this code as an example.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.