Prometheus stack¶
kube-prometheus-stack (Prometheus, Alertmanager, kube-state-metrics, node-exporter, the operator
and its CRDs), in three directories of components/prometheus-stack/:
| Directory | Holds | Used by |
|---|---|---|
. |
Namespace, HelmRepository, HelmRelease, the Alertmanager ExternalSecrets | every cluster |
config/ |
Our PrometheusRules and ServiceMonitors | every cluster |
grafana/ |
Grafana's OAuth secret, HTTPRoute, dashboards and dashboard-deployer Job | hetzner-mgmt |
config/ needs the CRDs the HelmRelease installs, so a new cluster applies it in a second Flux
Kustomization that depends on the first (as cluster/webshop/prometheus-stack/ does); hetzner-mgmt,
where the CRDs already exist, applies all three in one. Hetzner volumes made outside the cluster
(hetzner-mgmt's prometheus-pv and grafana-pv) are cluster-specific and live in the cluster's
overlay, which also sets volumeName.
The ten monitoring.coreos.com CRDs come from the chart's crds subchart, in its crds/
directory, not from templates. The HelmRelease sets install.crds and upgrade.crds to
CreateReplace, so every chart upgrade replaces them with the chart's version. With Flux's default
Create, hetzner-mgmt's CRDs stayed at 0.94.1 while the operator ran 0.94.2 (read 2026-11-21).
Changing the CRD policy does not run an upgrade by itself: helm-controller upgrades on a change of
chart, values or drift, so the CRDs move on the next chart upgrade or a forced reconcile. The
HelmRelease carries a matching reconcile.fluxcd.io/requestedAt and reconcile.fluxcd.io/forceAt
pair for that, which helm-controller handles once per value; set both to a new value to force the
upgrade through Git again.
Helm does not roll back CRDs: after a rollback the old operator runs against the newer CRDs. Before
an upgrade, run the pre-flight for CRD-bringing operators.
To see the version on a cluster:
kubectl --context <context> get crd -o json | jq -r '.items[]|select(.spec.group=="monitoring.coreos.com")|.metadata.name+" "+.metadata.annotations["operator.prometheus.io/version"]'
Prometheus keeps retention: 30d or retentionSize: 7GiB, whichever is reached first. The size
cap counts blocks and WAL, not the filesystem: a 10 Gi volume gives 9.75 GiB of ext4, of which about
0.5 GiB is reserved for root, and the upstream KubePersistentVolumeFillingUp fires under 15 % free.
With 8 GiB, usage peaked at about 8.1 GiB on hetzner-mgmt before each size retention and fired that
alert (incident 2026-10-30).
Keep the cap at about 70 % of the volume, and raise both together.
Read a scrape gap¶
Prometheus writes every scrape to its WAL on that Hetzner volume. When the volume stops completing
I/O, every scrape and rule evaluation stops. No alert can fire then, and when the volume resumes,
every target is scraped at the same instant
(incident 2026-11-04).
Afterwards a range query hides the gap. Instant values stay at their last sample for the 5-minute
lookback, so count(up) drops only 5 minutes after the gap began. rate(x[5m]) keeps
extrapolating from the few samples left in its window, so 1 - rate(node_cpu_seconds_total{mode="idle"}[5m])
looks like CPU climbing towards 100 % on every node. Read the raw samples instead:
up[15m] as an instant query at the end of the window gives each sample's timestamp, and
count_over_time(up[5m]) shows how many samples a window holds.
Webshop cluster¶
cluster/webshop/prometheus-stack/ runs the stack on the single-node webshop cluster, on its own:
no remote-write or federation, so Flagger and the agents' checks can query it while hetzner-mgmt or
the internet path is down (eloro/webshop-platform docs/design/09-own-cluster.md §4.6). Compared with
hetzner-mgmt:
- No Grafana (
grafana.enabled: false, nografana/). Shop dashboards stay as ConfigMaps in the shop chart. A Grafana datasource on hetzner-mgmt pointing at this Prometheus is not set up: the only route out of the cluster is the read-only query route, which serves instant queries for eloro CI and nothing a datasource needs. - Prometheus keeps 7 days (
retentionSize7 GiB) on a 10 Gihcloud-volumesvolume that the CSI driver creates. - Requests and limits on every pod, so one component cannot starve the shops on the one node
(design §6.1). Requests are the 7-day use plus about 25 %: the maximum of the memory working set
and the p95 of the 5m CPU rate, the same method as on hetzner-mgmt. First measured on 2026-11-07
(Taskbase #2018) after the demo shop had run for 7 days, again on 2026-11-14 (#2673) after 7 days
on those requests, and on 2026-11-21 (#2991) after 7 days of the
apiserverdrop (window 2026-11-14 15:30 to 2026-11-21 12:00 UTC):
| Pod (container) | Memory max / CPU p95, 2026-11-21 | Memory request / limit | CPU request / limit |
|---|---|---|---|
| Prometheus | 709Mi / 32m | 896Mi / 1Gi | 40m / 500m |
| Alertmanager | 27Mi / 0.6m | 32Mi / 64Mi | 10m / 100m |
| config-reloader (in Prometheus and in Alertmanager) | 14Mi and 13Mi / 0.2m | 24Mi / 40Mi each | 10m / 50m each |
| Operator | 43Mi / 3.6m | 64Mi / 128Mi | 10m / 200m |
| kube-state-metrics | 94Mi / 3m | 120Mi / 192Mi | 10m / 100m |
| node-exporter | 15Mi / 3.1m | 32Mi / 64Mi | 10m / 250m |
| Stack total | 847Mi (sum at its peak) | 1192Mi / 1552Mi | 100m / 1250m |
prometheus-gate (nginx, query route) |
6Mi / 0.1m | 16Mi / 64Mi | 10m / 100m |
The admission webhook's certificate Jobs (32Mi / 64Mi, 10m / 100m) run only on install and
upgrade. The CPU floor is 10m per container. To measure again, query webshop's
Prometheus with --context webshop, as in
Read Alertmanager and Prometheus on a cluster
(the Metrics API is not installed, so kubectl top does not work), and check that the targets
are webshop's: one node-exporter and no Grafana. hetzner-mgmt's Prometheus answers the same queries.
- Prometheus grew from a 627Mi peak in the first week to 769Mi in the second (heap in use
504Mi at most), with daily maxima of 91–109k head series against 90–95k. 57k of them came from the
apiserverjob, 40k of those from histogram buckets that only Grafana dashboards read. - Fewer
apiserverseries.kubeApiServer.serviceMonitor.metricRelabelingsdrops, on webshop only, the buckets ofapiserver_request_duration_seconds,apiserver_request_body_size_bytes,apiserver_response_sizes,apiserver_watch_events_sizes,apiserver_watch_list_duration_seconds,apiserver_watch_cache_read_wait_secondsandetcd_request_duration_seconds, and keeps the chart's own drop of noisy buckets (the list replaces the chart's default). Ofapiserver_request_sli_duration_seconds_bucketit keeps onlyle1, 5, 30 and+Inf: thekube-apiserver-burnrate.rulesandkube-apiserver-availability.rulesgroups read exactly those, soKubeAPIErrorBudgetBurnkeeps working. Thekube-apiserver-histogram.rulesgroup is off (defaultRules.rules.kubeApiserverHistogram: false): its p99 would be interpolated within those four buckets, and no alert reads it, only Grafana dashboards. The_countand_sumseries stay. Counted on the live series on 2026-11-14, the drop removes 40,098 of the job's 57,157 series, about 48 % of the head. - After the drop (configuration reloaded at 2026-11-14 09:53 UTC, the dropped series left
the head at its next truncation around 11:00, the working set fell by 15:30), the head holds
46–62k series, the heap in use peaks at 477Mi and the working set mostly at 440–590Mi. Its
maximum, 709Mi at 2026-11-21 08:57, came with a burst of
query_rangecalls that lifted the heap from about 300Mi to 477Mi for two minutes: queries, not ingestion, set the peak, so the estimate of about 585Mi, which scaled the heap with the head series only, was too low. The request is that maximum plus 26 %, 896Mi, up from 800Mi. Prometheus' pod was recreated three times in the week by chart upgrades and replayed its WAL each time under that maximum, so the 1Gi limit stays.apiserver_request:burnrate1hstill evaluates (0 forreadandwrite). - node-exporter was 54 % throttled at its old 100m CPU limit, with a 2.6m p95 and a 3m maximum
of the 5m rate (
CPUThrottlingHigh, severityinfo): its scrapes burst inside one 100 ms CFS period. The limit is 250m. The config-reloaders are 9–13 % throttled at 50m, under the alert's 25 %, and keep their limit. - kube-state-metrics used about 31Mi (22Mi RSS) until its pod was recreated on 2026-11-19
16:10, the first pod with the custom resource state behind
FluxNotReady(#3435). Since then it peaked at 94Mi at 18:03, 2Mi under its old 96Mi limit, and runs at 52–72Mi (p95 64Mi) with the same image (v2.20.0). The growth is heap, not page cache: RSS rose to 51–86Mi while the cache stayed at 13–14Mi, and on 2026-11-21 its own metrics (port 8081, which no ServiceMonitor scrapes) showed 38Mi of heap in use and 69Mi RSS. It does not come from series either: 5.4–5.6k before and after, 40 of themgotk_resource_info, and the chart upgrades 92.20–92.22 changed neither the image nor the--resourceslist. With a custom resource state configured, kube-state-metrics runs a discovery that lists and watches every CRD (customresourcedefinitionsin its ClusterRole) to resolve the configured kinds, and holds them in memory: 103 CRDs, about 18.9 MB as JSON, against 0.3 MB for the 40 HelmReleases and Kustomizations themselves. A CRD change makes it list them again; the 94Mi peak came two minutes after such a re-list (discovery finished, cache updatedat 18:01:25). It did not restart and was notOOMKilled. The request is that peak plus 28 %, 120Mi, and the 192Mi limit leaves room for a re-list while many CRDs change at once (on hetzner-mgmt, with more CRDs and no limit, it peaked at 160Mi in the week to 2026-11-21). - No container restarted or was
OOMKilledin any of the three weeks, andContainerOOMKilleddid not fire. The stack's sum peaked at 847Mi outside the chart rollouts of 2026-11-19; during them the old and new pods' series overlap and the sum reads up to 1128Mi.
Against design §6.1. The measured use of the stack, 847Mi (≈ 0.83 GiB), is just above the
design's 0.6–0.8 GiB for monitoring, and the requests, 1192Mi (≈ 1.16 GiB, 1208Mi with
prometheus-gate), are well above it. To meet it, Prometheus would have to request at most 507Mi
(the other containers request 296Mi plus the gate's 16Mi), a working-set peak of about 406Mi
against the measured 709Mi. The apiserver drop alone cannot get there. On 2026-11-21 the owner
chose to amend the budget instead of cutting metrics (Taskbase #3567): design §6.1's monitoring
budget becomes the stack's requests, 1192Mi (≈ 1.2 GiB), and nothing changes on the cluster. The
amendment itself belongs in eloro/webshop-platform docs/design/09-own-cluster.md and is not
made yet (Taskbase #3577); until it is, design §6.1 still reads 0.6–0.8 GiB. The two metric
drops stay recorded as alternatives, should the node run short:
| Option | Series or Mi saved | Cost | Status |
|---|---|---|---|
| Amend design §6.1's monitoring budget to the stack's requests, 1192Mi (≈ 1.2 GiB) | none | A design change | Chosen by the owner on 2026-11-21 (#3567) |
Drop most cAdvisor series from the kubelet job (/metrics/cadvisor, 6.7k series), keeping those the default container alerts read |
up to 13 % of the 51k head | Fewer per-container metrics for debugging | Alternative, not taken |
Drop the remaining histogram buckets of apiserver (apiserver_admission_*_bucket and others, 3.4k besides the SLI buckets the burn-rate rules need) and kubelet (prober_probe_duration_seconds_bucket, kubelet_runtime_operations_duration_seconds_bucket, 1.3k) |
about 9 % of the head | Fewer dashboards' latency panels; no alert reads them | Alternative, not taken |
Fewer series lower the heap that ingestion needs; the query peak above would shrink less.
CPU, 100m of requests, is under the design's 0.2. The node has 7117Mi (≈ 6.95 GiB) allocatable.
On 2026-11-07 its memory peaked at 55 % of allocatable as the sum of the containers' working
sets, and at 5144Mi (72 %) as MemTotal - MemAvailable, with about 4636Mi (65 %) requested. In
the week to 2026-11-21 the sum of the working sets peaked at 4564Mi (64 %), but
MemTotal - MemAvailable reached 5955Mi (84 % of allocatable, 77 % of the node's 7729Mi) on
2026-11-17 05:30, above the design's 80 %; about 4604Mi (65 %) was requested, 4772Mi (67 %)
with the new Prometheus and kube-state-metrics requests.
- The same receivers and routes as hetzner-mgmt. The OpenBao keys are under the webshop AppRole's
clusters/webshop/*: webshop/monitoring/alertmanager-mattermost (property webhookUrl) and
webshop/monitoring/taskbase-alertmanager-webhook (property token, the same value as
hetzner-mgmt/taskbase/alertmanager-webhook, which Taskbase checks). A person writes both; without
them the Mattermost Secret is missing and Alertmanager waits in Init. Both were written on
2026-10-28.
- The CRDs (ServiceMonitor, PrometheusRule and the rest of monitoring.coreos.com) come with the
HelmRelease, so a shop whose chart ships them depends on the Flux Kustomization prometheus-stack.
Prometheus selects ServiceMonitors and rules in every namespace without label selectors.
When the node is down this Alertmanager is down too; hetzner-mgmt's blackbox probes of the shops and the ops agent's API watchdog cover that case.
Read-only query route for eloro CI¶
eloro CI's staging gate (eloro #2439) reads the demo shop's firing alerts and running version from
this Prometheus (owner decision on eloro #2437, 2026-11-07). The Flux Kustomization
prometheus-gate (cluster/webshop/prometheus-stack/gate/) exposes exactly one endpoint:
| Request | Answer |
|---|---|
GET /api/v1/query with the token |
Prometheus' answer, unchanged |
| No token, a wrong one, or basic auth, on that path | 401 with WWW-Authenticate: Bearer |
Any other method (POST, PUT, HEAD, …) with the token |
405 |
Any other path, with or without the token (/api/v1/query_range, /api/v1/admin/…, /-/quit, the UI) |
404 |
How it works: the listener prometheus-gate-https of shared-gateway (Certificate
prometheus-gate-tls, routes from monitoring only) sends the exact path /api/v1/query to the
Deployment prometheus-gate, an unprivileged nginx (gate.conf). nginx checks the token, then the
method, drops the Authorization header and passes the request on to
monitoring-kube-prometheus-prometheus:9090 with the normalised path. The component sets
enableAdminAPI: true, so this allowlist, not Prometheus, is what keeps the admin API off the
route. query_range is not exposed: the gate asks two instant questions. To add it, add a rule to
httproute.yaml and a location to gate.conf, and a check to test-gate.sh.
The token is in OpenBao at webshop/prometheus-gate/token (mount clusters, property token): 64
hex characters, because nginx compares it case-insensitively and it sits inside a quoted nginx
string. The ExternalSecret prometheus-gate-token renders it into the nginx map that gate.conf
includes. Without it the pod waits in ContainerCreating and prometheus-gate is not Ready;
nothing else waits for it. The pod requests 10m CPU and 16Mi memory (limits 100m, 64Mi).
How the gate calls it, with the token in eloro's Actions secret WEBSHOP_PROMETHEUS_TOKEN:
curl -fsS -G https://prometheus.webshop.eloro.dk/api/v1/query \
-H "Authorization: Bearer $WEBSHOP_PROMETHEUS_TOKEN" \
--data-urlencode 'query=ALERTS{alertstate="firing",namespace="shop-demo"}'
An empty result means no alert is firing. The running version is a query too, for example
kube_pod_container_info{namespace="shop-demo"}, whose image label holds the running tag.
Owner's steps (once; and again to rotate the token). The token is never printed:
-
Write a new token to OpenBao and to eloro's Actions secret, before or right after the merge:
TOKEN=$(openssl rand -hex 32) printf '%s' "$TOKEN" | bao kv put -mount=clusters webshop/prometheus-gate/token token=- read -rs GITEA_ADMIN_TOKEN # a Gitea token that may write eloro/webshop-platform's secrets printf '{"data":"%s"}' "$TOKEN" | curl -sS -o /dev/null -w '%{http_code}\n' -X PUT \ -H "Authorization: token $GITEA_ADMIN_TOKEN" -H 'Content-Type: application/json' --data @- \ https://gitea.prod.skatzi.com/api/v1/repos/eloro/webshop-platform/actions/secrets/WEBSHOP_PROMETHEUS_TOKEN unset TOKEN GITEA_ADMIN_TOKENThe
PUTanswers201when it creates the secret and204when it replaces it. 2. The first time only: dispatch Terraform Apply - Webshop DNS for theprometheus.webshoprecord (see the webshop cluster's README). 3. On a rotation: nginx reads the map only at start, so runkubectl --context webshop -n monitoring annotate externalsecret prometheus-gate-token force-sync=$(date +%s) --overwriteand thenkubectl --context webshop -n monitoring rollout restart deployment/prometheus-gate. 4. Check: with the token,curl -sG -o /dev/null -w '%{http_code}\n' -H "Authorization: Bearer $WEBSHOP_PROMETHEUS_TOKEN" --data-urlencode query=up https://prometheus.webshop.eloro.dk/api/v1/queryprints200; without the header401; with-X POST405; andhttps://prometheus.webshop.eloro.dk/api/v1/admin/tsdb/snapshot404.
cluster/webshop/prometheus-stack/gate/test-gate.sh [nginx] runs gate.conf and the rendered
token map in a local nginx in front of a stub Prometheus and checks every row of the table above.
CI runs it on every pull request (CI Component Tests / prometheus-gate-test, with Ubuntu's
nginx-light); run it locally when you change gate.conf or external-secret.yaml.
Alerting¶
How alerts become Mattermost posts and Taskbase incident tasks for the ops agent, and which rules
and probes count as incidents, is decided in
ADR 0018. Prometheus adds
cluster: ${cluster_name} (externalLabels) to every alert, so alerts from hetzner-mgmt carry
cluster="hetzner-mgmt" and alerts from the webshop cluster cluster="webshop".
Receivers and routes¶
The routing tree is in alertmanager.config of helmrelease.yaml:
| Receiver | Gets | Notes |
|---|---|---|
null |
alertname=~"Watchdog\|InfoInhibitor" |
Always-firing alerts that only prove the pipeline works; sent nowhere |
taskbase |
incident="true" and severity=~"critical\|warning" |
Posts to POST /api/webhooks/alertmanager, which opens or updates one incident task per group; grouped by cluster, alertname, namespace and component (the dedupe key), group_wait 1 m, group_interval 5 m, repeated every 4 h, resolved alerts too. continue: true, so the alert goes on to Mattermost |
mattermost |
Everything not routed to null, incidents included |
Posts to #alerts, grouped by alertname and namespace, repeated every 4 h, resolved alerts too |
The Mac mini's host environment check independently polls Alertmanager for an active Watchdog and opens a GitHub issue when it disappears. This detects a stopped Alertmanager without using any Alertmanager receiver.
Alertmanager uses the root route's receiver only for alerts that match no child route, so
mattermost is also the last child route: without it, an incident would reach only Taskbase. Check
a change with amtool config routes test --config.file=<rendered config> incident=true severity=warning,
which must print taskbase,mattermost.
The Mattermost incoming webhook URL is in OpenBao at hetzner-mgmt/monitoring/alertmanager-mattermost
(KV mount clusters, property webhookUrl). The ExternalSecret alertmanager-mattermost-webhook in
external-secret.yaml syncs it into the Secret of the same name, which Alertmanager mounts; the
cluster sets the OpenBao path in cluster/hetzner-mgmt/prometheus-stack/manifests/kustomization.yaml.
To rotate the webhook, put the new URL at that path; the ExternalSecret refreshes within an hour.
The taskbase receiver's bearer token is in OpenBao at hetzner-mgmt/taskbase/alertmanager-webhook
(property token), the same key Taskbase prod reads as ALERTMANAGER_WEBHOOK_TOKEN. The
ExternalSecret taskbase-alertmanager-webhook syncs it into the Secret of the same name, which
Alertmanager mounts and reads as credentials_file on every request. It is mounted as an optional
volume (alertmanagerSpec.volumes), not through alertmanagerSpec.secrets: a mount from secrets
is required, so a missing token kept the Alertmanager pod in Init and stopped all alerting
(incident 2026-10-24).
Without the token only the taskbase receiver fails, with unable to read authorization
credentials in the Alertmanager log; Mattermost keeps working. The cluster sets the OpenBao
path and the receiver URL (https://taskbase.skatzi.com/api/webhooks/alertmanager) in the same
cluster kustomization. To rotate the token, put the new value at that path, wait for the
ExternalSecret to refresh (or annotate it with force-sync) and restart platform-tasks-api in
tasks-prod, which reads it only at start; until both sides match, Taskbase answers 401.
Read Alertmanager and Prometheus on a cluster¶
Each cluster runs its own Prometheus and Alertmanager under the same Service names, so a command
reads whichever cluster its kubeconfig context points to. Name the context in every command
(--context <context>; which context belongs to which cluster label is in the ops runbook's
rules of engagement). Read through the API
server's Service proxy, not a port-forward: it uses no local port, so nothing is left running, and
nothing started earlier can answer in its place. On 2026-11-09, port-forwards to hetzner-mgmt left
over from earlier runs held localhost:9090, 9093 and 9094 on the ops runner, and a check for
the webshop cluster read hetzner-mgmt's alerts instead (eloro #2758, task #2774).
AM=/api/v1/namespaces/monitoring/services/http:monitoring-kube-prometheus-alertmanager:9093/proxy
PROM=/api/v1/namespaces/monitoring/services/http:monitoring-kube-prometheus-prometheus:9090/proxy
# Alerts: cluster, name, namespace and state of each
kubectl --context <context> get --raw "$AM/api/v2/alerts" \
| jq -r '.[] | [.labels.cluster, .labels.alertname, .labels.namespace, .status.state] | @tsv'
# A PromQL instant query; jq URL-encodes it
q='kube_job_failed{namespace="<namespace>"} > 0'
kubectl --context <context> get --raw "$PROM/api/v1/query?query=$(jq -rn --arg q "$q" '$q|@uri')" \
| jq '.data.result'
The ops watchdog reads alerts through the same proxy path (cluster/mac-mini/host/ops-env-check.sh).
For a range, use $PROM/api/v1/query_range?query=…&start=…&end=…&step=60. Writes go through the
proxy too, with kubectl create --raw (POST), as in
Test the incident path end to end. The commands on this page
were not run against a cluster when they were written (task #2774); jq printed
up%7Bjob%3D%22apiserver%22%7D for up{job="apiserver"}.
Before you trust the answer, check which cluster gave it:
- Every alert carries
cluster(hetzner-mgmtorwebshop). Every row of the alert list above must show the cluster you meant. - Query results do not carry
cluster; check the nodes instead.count by (nodename) (node_uname_info)answers onlywebshop-controlplane-0on the webshop cluster. kubectl config current-contextshows the cluster that a command without--contextreads:admin@mgmt-clusteron the ops runner. A command copied from an incident report without--contextreads that cluster.
When you need a browser (the Prometheus graph or the Alertmanager UI), port-forward to a free local port in the foreground and stop it with Ctrl-C when you are done:
kubectl --context <context> -n monitoring port-forward svc/monitoring-kube-prometheus-prometheus :9090
# Forwarding from 127.0.0.1:<port> -> 9090: open http://127.0.0.1:<port>
When a tool needs a URL (amtool), start the port-forward and stop it in the same step, in a
subshell. Use the cluster's own port, 29093 (Alertmanager) or 29090 (Prometheus) for hetzner-mgmt
and 19093 or 19090 for webshop, so the two clusters never share one. If the port is taken,
kubectl exits at once and the step stops instead of reading whatever holds the port:
(
kubectl --context <context> -n monitoring port-forward svc/monitoring-kube-prometheus-alertmanager <port>:9093 & PF=$!
trap 'kill $PF 2>/dev/null' EXIT
sleep 3; kill -0 $PF 2>/dev/null || exit 1 # port taken or no access: stop here
amtool --alertmanager.url=http://127.0.0.1:<port> alert query
)
This subshell was tested in bash and zsh with a stand-in for kubectl: the port-forward was gone
after the closing ), and a taken port ended the step with exit code 1.
Silence an alert¶
Silences are the only maintenance window: a silenced alert reaches no receiver, so it opens no
incident either. There are no recurring time_intervals. Always give a silence
an end time and a comment naming the task it belongs to. In the Alertmanager UI choose New Silence,
or with amtool against the cluster's Alertmanager, through a port-forward that the same step stops
(Read Alertmanager and Prometheus on a cluster
has the ports):
(
kubectl --context <context> -n monitoring port-forward svc/monitoring-kube-prometheus-alertmanager <port>:9093 & PF=$!
trap 'kill $PF 2>/dev/null' EXIT
sleep 3; kill -0 $PF 2>/dev/null || exit 1
AM=http://127.0.0.1:<port>
amtool --alertmanager.url=$AM silence add alertname=KubePodNotReady namespace=gitea \
--duration=2h --comment="#1234: Gitea upgrade"
amtool --alertmanager.url=$AM silence query
# later: amtool --alertmanager.url=$AM silence expire <id>
)
Test the incident path end to end¶
A synthetic alert must carry cluster itself: externalLabels are added by Prometheus, not by
alerts sent to Alertmanager directly. Keep the ops agent away from it first: set the ops runner's
slots to 0 (Taskbase set_runner_slots, or the runner page), and restore them afterwards. An agent
run cannot change runner slots; when the test runs as a role=ops task on the runner's only slot,
that run itself keeps the ops agent from claiming the incident.
The ops runner has no amtool, so post the alert to the Alertmanager API through the Service proxy
(Linux date; on macOS use date -u -v+10M). The context and the cluster label must name the
same cluster:
AM=/api/v1/namespaces/monitoring/services/http:monitoring-kube-prometheus-alertmanager:9093/proxy
START=$(date -u +%Y-%m-%dT%H:%M:%SZ); END=$(date -u -d +10min +%Y-%m-%dT%H:%M:%SZ)
kubectl --context admin@mgmt-cluster create --raw "$AM/api/v2/alerts" -f - <<EOF
[{"labels": {"alertname": "SyntheticIncidentTest", "cluster": "hetzner-mgmt",
"namespace": "monitoring", "component": "synthetic-test", "severity": "warning",
"incident": "true"},
"annotations": {"summary": "Synthetic incident test, ignore"},
"startsAt": "$START", "endsAt": "$END"}]
EOF
kubectl --context admin@mgmt-cluster get --raw "$AM/api/v2/alerts" \
| jq -c '.[] | select(.labels.alertname == "SyntheticIncidentTest")
| {cluster: .labels.cluster, state: .status.state, receivers: [.receivers[].name]}'
The alert lists the receivers taskbase and mattermost. After group_wait (1 m) one incident
task appears in the Platform project, assigned to operator with required_labels: ["role=ops"]
(platform-tasks-api logs alertmanager webhook: created), and #alerts gets a [FIRING] post.
After the end time passes, Alertmanager sends the resolve with the group's next flush
(group_interval, 5 m): the task is closed (alertmanager webhook: closed) and Mattermost gets
[RESOLVED]. Then restore the ops runner's slots. alertmanager_notifications_failed_total on
Alertmanager's /metrics shows failed deliveries per integration (webhook for Taskbase, slack
for Mattermost).
On the webshop cluster run the same with kubectl --context webshop and "cluster": "webshop"
in the alert. The Watchdog alert goes to the null receiver there too, so it shows that Prometheus
reaches Alertmanager with the cluster label (amtool alert query alertname=Watchdog or the
Alertmanager UI), not that the receivers work; the synthetic alert tests those.
Last passed on 2026-10-24 (Taskbase #1530): alert fired at 21:31:11Z, incident #1559 was created at 21:32:11Z and closed by the resolve at 21:42:11Z. On webshop it last passed on 2026-10-28 (Taskbase
2015): the alert fired at 18:23:48Z, incident #2026 was created at 18:24:48Z and closed by the¶
resolve at 18:34:49Z, and the Mattermost and webhook integrations had no failed notifications.
Incident alerts¶
An alert is an incident, one that Taskbase turns into a task for the ops agent, only when it carries
the label incident: "true" and severity critical or warning. Every alert also goes to
Mattermost; alerts without the label go only there. What is opted in today:
- The upstream kube-prometheus-stack rule groups
kubernetesAppsandkubernetesStorage, throughdefaultRules.additionalRuleGroupLabelsinhelmrelease.yaml. Their upstreamrunbook_urls stay. - Our rules in the
health-signal-alertsPrometheusRule ofconfig/prometheus-rules.yaml:ContainerOOMKilled,PodEvicted,NodeEphemeralStorageLow,NodeMemoryEvictionsFrequent,CertificateExpiringSoon,CertificateNotReadyandExternalSecretNotReady,ProbeFailed,GiteaAPISlow,GiteaPushMirrorFailing,OpenBaoSnapshotFailedandOpenBaoRestoreDrillFailed. Their metrics come from kube-state-metrics, node-exporter, thecert-managerServiceMonitor, the ServiceMonitor of the external-secrets chart (serviceMonitor.enabled) and the Probes of the blackbox exporter. Both ServiceMonitors sethonorLabels: true, sonamespaceis the namespace of the Certificate or ExternalSecret, not of the operator. FluxNotReady, in thefluxgroup of the same file: the HelmReleaseflux-system/flux2, the Kustomizationflux-systemor the cluster's root KustomizationReady=Falsefor 10 minutes. Its metricgotk_resource_info(labelscustomresource_kind,namespace,name,ready, andpathon Kustomizations) comes from the kube-state-metrics custom resource state inhelmrelease.yaml, as the Flux monitoring docs build it; the chart'srbac.extraRuleslet kube-state-metrics list and watch HelmReleases and Kustomizations. Itsrunbook_urlis the ops runbook section on theflux2self-upgrade (#3400).- The CNPG backup alerts
CNPGRestoreDrillFailed,CNPGWALArchivingFailingandCNPGBackupStale, incomponents/cloudnative-pg/drill-alerts/prometheus-rule.yaml(see CloudNativePG).test-rules.shloads that file too, so their test cases live in the samerules-test.yaml. HarborRegistryStorageErrors, incomponents/harbor/base/prometheus-rule.yaml, on the registry metrics from Harbor's ServiceMonitor (see Harbor).test-rules.shloads it as well.GiteaActionsStalled, incomponents/gitea/actions-exporter/prometheus-rule.yaml, on the runner and job-queue metrics of the Gitea Actions exporter (see Gitea Actions Runners on the Mac Mini).test-rules.shloads it as well.- The hetzner-mgmt Object Storage alerts
ObjectStorageApproachingIncludedCapacity,ObjectStorageExporterFailedandHarborBucketNearUpgradeGateBound, incluster/hetzner-mgmt/prometheus-stack/manifests/prometheus-rule.yaml, on the bucket scans of the Object Storage exporter. The last one warns before the Harbor bucket outgrows the Harbor upgrade gate's volumes.test-rules.shloads this file as well.
The node-resources and persistent-volumes groups (node CPU/memory, PVC 80 %/90 %) stay
Mattermost-only.
Make a new alert an incident¶
Do it in one pull request:
- Give the rule the labels
severity(criticalorwarning) andincident: "true", andcomponentwhen the component is not the alert'snamespace. Addrepository: owner/repowhen the fix lives outsideSkatzi/platform. - Give it the annotations
summary,description(both naming the object) andrunbook_url. - Write the runbook page in
docs/content/contribution/components/renovate/runbooks/, named after the alert in lowercase (ExternalSecretNotReady→externalsecretnotready.md): what the alert means, the read-only checks first, then roll forward and roll back with links into the ops runbook. Add it to the table on the runbooks index. Therunbook_urlis the published page,https://docs.prod.skatzi.com/contribution/components/renovate/runbooks/<alert>/. - Add a test case to
components/prometheus-stack/tests/rules-test.yamland runcomponents/prometheus-stack/tests/test-rules.sh(needspromtooland Python with PyYAML). CI runs it asCI Component Tests / prometheus-rule-tests. Hetzner-mgmt-specific rules live incluster/hetzner-mgmt/prometheus-stack/manifests/prometheus-rule.yamland are included by the same test script.
To opt in another upstream group, add it under defaultRules.additionalRuleGroupLabels and check
that each of its alerts has a runbook the agent can follow.
Platform health dashboard¶
Platform health (components/prometheus-stack/grafana/platform-health.json, decided in
ADR 0018 §6) is Grafana's
home dashboard on every cluster that runs this component: the one
place to see whether the platform is healthy. Kustomize turns it into a ConfigMap labelled
grafana_dashboard: "1"; the Grafana sidecar writes it to
/tmp/dashboards/platform-health.json, which grafana.ini dashboards.default_home_dashboard_path
names. Change it in git, not in the UI: the sidecar overwrites UI edits. A home dashboard picked in
an organisation's or user's preferences takes precedence over this default.
Every panel reads Prometheus series that may not exist yet; a panel without series shows its "no value" text, not an error.
| Panel | What it shows | Where to go next |
|---|---|---|
| Where to go next | Links to the Taskbase Platform board (open incident tasks, kind incident) and Mattermost, where you open the #alerts channel (the link goes to the front page: the team slug a channel URL needs is not recorded in this repository) |
Taskbase for what is being worked on, Mattermost for the alert stream |
| Firing critical / warning | Count of firing alerts per severity (ALERTS, without Watchdog and InfoInhibitor) |
The table beside it |
| Firing alerts by severity and component | Every firing alert with its component, namespace and alertname; incident marks alerts that open a Taskbase incident |
The incident task in Taskbase, or the alert's runbook in the ops runbook |
| Probe status per public host | probe_success of each blackbox probe: UP when the host answered 2xx/3xx |
ProbeFailed runbook; the component's pods and HTTPRoute |
| Gitea API latency | probe_duration_seconds of the Gitea API probe (a target whose URL contains /api/); red line at 2 s, where GiteaAPISlow fires |
Gitea and its database pods |
| PVC usage | Share of each PVC in use, fullest first; red over 80 % (PersistentVolumeFillingUp) |
Grow the volume or clean up its data |
| Days until full | Free space divided by the daily growth of a 7-day linear fit (predict_linear); only growing PVCs are listed; red under 14 days |
Plan the resize before the date |
| PVC used vs capacity | Used bytes and capacity (dashed) per PVC over time | Spot a sudden jump against steady growth |
| Certificate expiry | Days until each cert-manager certificate expires; orange under 14, red under 3 (CertificateExpiringSoon) |
kubectl --context admin@mgmt-cluster describe certificate in its namespace |
| ExternalSecrets not Ready | ExternalSecrets whose Ready condition is False; also empty while ESO metrics are not scraped |
ExternalSecretNotReady runbook |
| CNPG last successful backup | Age of the newest Barman Cloud base backup per database pod; red after 2 days (CNPGBackupStale) |
The cluster's ScheduledBackup and its Backup objects |
| CNPG restore drill — last success | Time since each drill CronJob in cnpg-drill last succeeded; red after 8 days (CNPGRestoreDrillFailed) |
The drill Job's log in namespace cnpg-drill |
| Pods crash-looping by namespace | Containers in CrashLoopBackOff (kube-state-metrics) |
kubectl --context admin@mgmt-cluster -n <namespace> logs --previous |
| Pods not ready by namespace | Pending, Running or Unknown pods that are not Ready; finished Job pods are left out | kubectl --context admin@mgmt-cluster -n <namespace> describe pod |
| Gitea Actions runners online and jobs waiting | Online runners per runner label and waiting jobs per runs-on labels, from Gitea's admin API through gitea/gitea-actions-exporter; the runners are ephemeral, so none online is normal while nothing waits |
GiteaActionsStalled runbook |
| Oldest waiting Gitea Actions job by runs-on | How long the oldest job has waited for a runner, per runs-on labels; red line at 30 minutes, where GiteaActionsStalled fires |
Same |
| Total Object Storage vs included 1 TB | Sum of all measured object versions, including non-current versions; warning at 800 GB | Capacity runbook |
| Bucket usage by version | Current and non-current bytes by bucket (skatzi-backups, skatzi-harbor-registry) |
Check retention and old versions before deleting data |
| 30 day Object Storage growth | Observed change in bytes per bucket over a rolling 30 day window (shorter until 30 days of data exist) | Check backup retention if growth is unexpectedly high |
Flux readiness is not on the dashboard: deploy failures become Taskbase tasks (ADR 0018, deferred).
Cluster overview dashboard¶
Cluster overview (components/prometheus-stack/grafana/cluster-overview.json) does not go through the
dashboard sidecar. Kustomize turns it into the ConfigMap cluster-overview-dashboard, and the Job
monitoring/dashboard-deployer (grafana/dashboard-deployer.yaml) waits for Grafana's /api/health, then
posts it to /api/dashboards/db with overwrite: true. The Job carries Flux's force annotation,
so any change to it (a new curl image, for example) makes Flux recreate it and publish again.
The Job authenticates as the Grafana service account dashboard-deployer (role Editor), not as
admin, so it no longer depends on the admin password matching the chart's Secret
(incident 2026-10-20).
Its token is in OpenBao at clusters/hetzner-mgmt/monitoring/grafana-dashboard-deployer, property
token; the ExternalSecret grafana-dashboard-deployer in grafana/external-secret.yaml syncs it into the
Secret of the same name, and cluster/hetzner-mgmt/prometheus-stack/manifests/kustomization.yaml
sets the path. The Job sends it as Authorization: Bearer.
The token lives in Grafana's database on grafana-pv. If that database is lost or recreated, a
person must create the service account and its token again in Grafana (Administration → Users and
access → Service accounts), store the token at the same OpenBao path, and replace the Job.