Whats the difference between Unhealthy vs Degraded .NET health check status

核能气质少年 提交于 2019-12-23 18:03:29

问题


I have an application running in Kubernetes. To take the advantage of rolling updates with no downtime, I have to implement the proper Health Checks, so the cluster can know when the application/container is ready to handle requests.

I'm trying to use the new ASP.NET Code 2.2 Healthchecks feature.

I should return a Microsoft.Extensions.Diagnostics.HealthChecks.HealthCheckResult struct with the status of the application.

This struct has 3 static methods that I can use to return this status:

  • Healthy
  • Unhealthy
  • Degraded

In which situations that the app is not OK that I should use Unhealthy vs Degraded? A few examples would be good.


回答1:


A "degraded" check could be used for checks that did succeed but are slow or unstable. E.g. a simple database query did succeed but took more than a second. Moving traffic to another instance is probably a good idea until the problem has resolved.

An "unhealthy" check means that the component does not work at all. E.g. a connection to the Redis cache could no be established. Restarting the instance could solve this issue.

Quoting the blog post:

A failed liveness probe says: The application has crashed. You should shut it down and restart.

A failed readiness probe says: The application is OK but not yet ready to serve traffic.

You could say that a "degraded" health check maps to the "readiness" probe and an "unhealthy" check maps to the "liveness" probe.



来源:https://stackoverflow.com/questions/52027674/whats-the-difference-between-unhealthy-vs-degraded-net-health-check-status

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!