Files
platform-core/services/observability/alerting
DongHyeonka 11c13bb87b feat(observability): alert when Prometheus itself stops working
Nothing tells the owner when monitoring itself fails. On 2026-11-11
Prometheus stored samples 9 hours ahead, then rejected every new
sample as out of bounds: rules kept running on no data, and the only
sign was a false KubeAPIDown. If Prometheus, Alertmanager or the node
went down, no rule could fire at all.

Add two rules and one route. PlatformMetricsIngestionStopped fires
when no up sample from node-exporter is stored for 5 minutes;
absent() still fires while the TSDB rejects samples. PlatformHeartbeat
always fires, and a new platform-heartbeat route sends it every 5
minutes to an external dead man's switch through a webhook whose URL
comes from the Secret alertmanager-heartbeat. When the pings stop,
that service alerts, which covers Prometheus, Alertmanager, the node
and the network being down. The chart Watchdog stays disabled; the
platform rule keeps the route inside this repository.

Rejected: an in-cluster CronJob that queries Prometheus and posts to
Alertmanager. It still depends on Alertmanager and the node, and
needs a new workload in the exact observability NetworkPolicy matrix.

Risk: the AlertmanagerConfig now references alertmanager-heartbeat;
applying it before that Secret exists keeps the operator from
rendering the new Alertmanager config. The alerting README orders the
steps: create the external check, create the Secret, then apply.
The heartbeat needs an account on an external service, which only
the owner can create.

Verification: promtool tests for both rules failed against the old
rules and pass now. test-observability-alerting.sh pins the new route
and receiver in its exact contract and passes the static contract,
the global Alertmanager render with Helm v3.19.4 and the server
dry run (--server-dry-run). kubectl apply --dry-run=server accepts
the updated PrometheusRule.
2026-11-11 23:52:13 +09:00
..

Alertmanager 경로

platform-alertmanager.yaml은 kube-prometheus-stack이 전역 alertmanagerConfiguration으로 읽는 AlertmanagerConfig 하나다. 경로는 셋이다.

경보 receiver 보내는 곳
InfoInhibitor platform-null 버린다
PlatformHeartbeat platform-heartbeat 외부 heartbeat 서비스(dead man's switch), 5분마다
나머지 platform-slack Slack, 4시간마다 다시

heartbeat (dead man's switch)

PlatformHeartbeat(rules/platform/core-rules.yaml)는 항상 울린다. Alertmanager가 이것을 5분마다 외부 서비스의 ping URL로 보낸다. ping이 끊기면 그 서비스가 소유자에게 알린다.

  • 막는 것: Prometheus·Alertmanager가 죽었을 때, desktop이나 인터넷 연결이 끊겼을 때. 이 경우는 클러스터 안의 어떤 규칙도 알리지 못한다.
  • 막지 못하는 것: Prometheus가 돌면서 샘플만 버리는 경우(2026-11-11 시계 사고). 규칙은 돌고 heartbeat도 계속 나간다. 그 경우는 PlatformMetricsIngestionStopped가 Slack으로 알린다.

소유자가 할 일 (적용 전에 한 번)

  1. 외부 heartbeat 서비스에 check를 하나 만든다. 예: healthchecks.io(무료 요금제, 오픈소스라 나중에 직접 띄울 수도 있다). 주기 5분, 유예 10분. 알림은 Slack이 아닌 곳(메일·휴대폰)도 하나 건다. Slack 경로가 죽었을 때도 알아야 하기 때문이다.

  2. ping URL을 Secret으로 만든다. URL 자체가 자격 증명이라 화면에 남기지 않는다.

    read -rs HEARTBEAT_URL   # ping URL 붙여 넣기, 화면에 안 보임
    printf '%s' "$HEARTBEAT_URL" | kubectl -n observability create secret generic alertmanager-heartbeat \
      --from-file=url=/dev/stdin
    unset HEARTBEAT_URL
    
  3. 그 뒤에 rules·alerts를 다시 적용한다(scripts/bootstrap/apply-observability-access.sh --execute --rules-alerts). Secret보다 먼저 적용하지 않는다. operator가 없는 Secret을 가리키는 AlertmanagerConfig로는 설정을 만들지 못한다.

  4. 확인: 외부 서비스의 check가 5분 안에 「up」이 된다. Alertmanager 지표 alertmanager_notifications_total{integration="webhook"}가 5분마다 는다.

Alertmanager egress는 공개 IPv4 TCP/443만 허용한다(alertmanager-public-https-egress.yaml). ping URL은 HTTPS여야 한다.