Health
What healthy, progressing, degraded and unknown mean, how Wardn decides, and how health rolls up from objects to deployments.
Applying objects is not the same as them working. Health is Wardn's answer to "is what I deployed running properly", and it comes from the cluster, not from the apply succeeding. Read Deployments first.
The four states
| State | Meaning |
|---|---|
healthy | Every object is ready: Deployments have their replicas, Jobs completed, volume claims bound, and so on. |
progressing | Something is still becoming ready, such as a rollout in progress. This is normal right after an apply. |
degraded | Something is failing or stuck, and Wardn shows the reason for the worst object. |
unknown | Wardn cannot tell: a health rule failed to evaluate, the status could not be read, or the deployment has no objects to watch. |
Where health comes from
The operator in each cluster watches the objects it applied and reports their health. Built in, it follows the standard Kubernetes readiness rules for the kinds Kubernetes defines (the rules kstatus implements). It also marks a workload degraded when its pods are stuck crash-looping or cannot pull their image, since a rollout can look "progressing" for a long time in those cases.
For a kind those rules do not understand, such as a custom resource, you write a health rule: two CEL expressions over the live object, available as object.
{
"group": "example.com",
"kind": "Widget",
"healthy": "object.status.phase == 'Ready'",
"failed": "object.status.phase == 'Error'",
"message": "object.status.message"
}failed is checked first. message is shown for an object that is not healthy. A deployment can have up to 50 health rules. A rule for a kind decides alone for objects of that kind; other kinds follow the standard rules. See Health rules and the recipe Health rule for a custom resource.
How health rolls up
Health is the worst of its parts, at each level. From worst to best the order is degraded, progressing, unknown, healthy.
object ──▶ app ──▶ deployment
a Pod all its worst app,
a Job objects and worst clusterA deployment on an environment shows one health per cluster and the worst overall. An app with one failing object makes its deployment degraded, and the reason shown is that object's.
Health and the apply
Waves use readiness too. Each wave waits for the one before to become ready, so a wave that never becomes ready holds back the waves after it, for example the application that depends on a database in an earlier wave. See Sync and arrival.
Health is separate from sync and from drift. A deployment can be synced and degraded (the snapshot arrived and does not work), or healthy and drifted (it works, and someone changed it).
What health does not do
Wardn reports health; it does not roll a failing deployment back on its own because pods are unhealthy. Automatic rollback is tied to a failing job, as described in Snapshots. Checks that gate a rollout on metrics are planned; see Releases and approvals.
Guides that use this
- Health rules: write a rule for your own kinds.
- Jobs and waves.
- Recover from a bad change.