Investigation & Containment
Investigation
Five checks, in this order: what fires right now, which receiver each alert reached, what the backend’s requests are by path, what users’ requests are per environment, and whether the heartbeat reaches the outside. Together they answer three questions: does the platform see the problem, does anybody hear it, and does the signal measure what users get. Every command names the cluster with --context (Chapter 01). The Prometheus and Alertmanager APIs are reached through port-forwards - each one keeps its terminal busy, so run Prometheus’s in a second terminal and Alertmanager’s in a third, and leave both open:
kubectl --context kind-sre-control-plane -n observability port-forward svc/kube-prometheus-stack-prometheus 9090:9090
kubectl --context kind-sre-control-plane -n observability port-forward svc/kube-prometheus-stack-alertmanager 9093:9093
What fires right now? Every alert Prometheus considers active, by name and state:
curl -sG localhost:9090/api/v1/query --data-urlencode 'query=count by (alertname, alertstate) (ALERTS)' \ | jq -r '.data.result[] | "\(.metric.alertname) \(.metric.alertstate)"'On your cluster at rest:
Watchdog firingand nothing else. In the story: eleven lines, one of them critical, none of them needing an action - the reason nobody read the channel.Where does an alert go? Alertmanager says which receiver each active alert reached:
curl -s localhost:9093/api/v2/alerts | jq -r '.[] | "\(.labels.alertname) \(.labels.namespace // "-") -> \(.receivers | map(.name) | join(","))"'On your cluster:
Watchdog - -> null- the heartbeat, deliberately going nowhere on kind. In the story, the backend alert showed-> nulltoo: no route, no integration, no human.What is the backend’s error rate measured on? All requests, by path, over the last hour:
curl -sG localhost:9090/api/v1/query --data-urlencode 'query=sum by (path) (increase(app_http_requests_total{job="backend",namespace="develop"}[1h]))' \ | jq -r '.data.result[] | "\(.metric.path) \(.value[1] | tonumber | floor)"'On an idle cluster:
/readyz,/livez,/metrics- the kubelet’s probes and Prometheus’s own scrapes - are almost all of it. An error rate over all requests divides a real failure by traffic no user made.What do users get? The platform’s recording rule counts only user requests, per environment:
curl -sG localhost:9090/api/v1/query --data-urlencode 'query=backend:user_requests:rate5m' \ | jq -r '.data.result[] | "\(.metric.namespace) \(.value[1])"'On an idle cluster: nothing, or a value near zero - correctly. No users, no signal; and the alerts built on it stay silent rather than fire on noise.
Does the heartbeat reach the outside? On the platform, the Watchdog goes to Healthchecks.io every minute; when the pings stop, Healthchecks.io alerts by e-mail. On kind it is routed to
nullon purpose - there is no outside to reach.
The root cause is not a missing alert. It is an alerting setup nobody could trust: alerts that needed no action drowned the one that did, the important one had no route, and its number was diluted by traffic no user made.
Containment
- Roll back the release (Chapter 10) - users first; the investigation can wait for the next morning.
- Silence what asks for no action - in Git: the rules for components the cluster does not expose, and alerts that fire by design.
- Measure users, per environment - recording rules on user requests only.
- Route - production to the production receiver, the rest to non-production; grouped by namespace and alert name, so different alert names form separate groups - but while a critical backend alert fires, it inhibits the backend warnings of the same namespace, so two firing alerts do not always mean two notifications. A group repeats only while it still fires.
- Prove the path - send a test alert and see it arrive, before the next release needs it.
An alert is a request for a person to act. Send fewer, about what users get, to someone who will see it - and prove the path before you need it.
Pause and Predict: A short burst of ten failed requests in develop, on an otherwise idle cluster. Is that an incident? What should the alerting do - and what should it not do?