Health Check

The goal of Health Checks is to minimize the number of failed requests due to temporary unavailability of a target endpoint. By applying a Health Check policy you effectively instruct a dataplane to keep track of health statuses for target endpoints. Dataplane will never send a request to an endpoint that is considered “unhealthy”.

Since pro-active health checking might result in a tangible extra load on your applications, Kuma also provides a zero-overhead alternative - “passive” health checkingHealth Check - 图1. In the latter case, a dataplane will be making decisions whether target endpoints are healthy based on “real” requests initiated by your application rather than auxiliary requests initiated by the dataplanes itself.

As usual, sources and destinations selectors allow you to fine-tune to which Dataplanes the policy applies (sources) and what endpoints require health checking (destinations).

At the moment, HealthCheck policy is implemented at L4 level. In practice, it means that a dataplane is looking at success of TCP connections rather than individual HTTP requests.

On Universal:

  1. type: HealthCheck
  2. name: web-to-backend
  3. mesh: default
  4. sources:
  5. - match:
  6. service: web
  7. destinations:
  8. - match:
  9. service: backend
  10. conf:
  11. activeChecks:
  12. interval: 10s
  13. timeout: 2s
  14. unhealthyThreshold: 3
  15. healthyThreshold: 1
  16. passiveChecks:
  17. unhealthyThreshold: 3
  18. penaltyInterval: 5s

On Kubernetes:

  1. apiVersion: kuma.io/v1alpha1
  2. kind: HealthCheck
  3. metadata:
  4. namespace: kuma-example
  5. name: web-to-backend
  6. mesh: default
  7. spec:
  8. sources:
  9. - match:
  10. service: web
  11. destinations:
  12. - match:
  13. service: backend
  14. conf:
  15. activeChecks:
  16. interval: 10s
  17. timeout: 2s
  18. unhealthyThreshold: 3
  19. healthyThreshold: 1
  20. passiveChecks:
  21. unhealthyThreshold: 3
  22. penaltyInterval: 5s