DEV Community

Cover image for Nobody knew the site was down for 4.5 hours. Prometheus + Grafana on Kubernetes with one Helm chart
CD Security Lab
CD Security Lab

Posted on

Nobody knew the site was down for 4.5 hours. Prometheus + Grafana on Kubernetes with one Helm chart

Sources: CD's devops wiki 03-kubernetes/09-lab-prometheus-grafana-helm.md (Helm, Prometheus chart, ingress-nginx, external NGINX LB), 04-observability/01-exporters-and-grafana-overview.md, 02-lab-prometheus-on-windows.md and 03-lab-connect-grafana.md, cross-checked against the prometheus-community chart releases, Helm 4, Grafana Cloud and Datadog price lists and a public post-mortem on 2026-10-28. Lab names only; screens are drawings.

Tuesday 22:01. A disk on one of Contoso's worker nodes hangs for a minute. The kubelet marks the node NotReady, forty pods are evicted, and the ones with a PersistentVolume stay Pending because their disk is still attached to the dead node. The web shop front end keeps serving cached pages from the CDN, so the uptime checker is green.

At 02:34 a customer emails: "checkout has said try again later since last night". Four and a half hours. Nobody was paged, because nothing was watching the nodes, the volumes or the pods. The fix took five minutes.

A hosting provider published almost exactly this incident for the night of 2026-05-19: one NVMe drive failed uncleanly, about 200 containers died, no alert fired, and the operator noticed 4.5 hours later. Their reachability checks were green the whole time because a CDN kept serving the front pages.

TL;DR

  • Problem: a cluster without metrics fails silently. Evictions, full disks, crash loops and Pending pods do not send email. A green uptime check only means the cache is up.
  • Who it hurts: customers (hours of a broken checkout), the business (every hour of a 02:00 outage is an hour of lost orders plus the morning's reputation), on-call (woken by a customer instead of a pager), security (the same blind spot hides a crypto-miner eating CPU).
  • Fix: one Helm chart, kube-prometheus-stack, installs Prometheus, Alertmanager, Grafana, node-exporter on every node, kube-state-metrics and about a hundred alert rules that already know what NotReady, FillingUp and CrashLooping look like. Add one rule for your app and one receiver for your phone.
  • Cost: open source; the chart uses node capacity you already pay for plus 50 to 60 GiB of disk (about $5 to $10 a month). Managed alternatives: Grafana Cloud free up to 10k series, Pro from $19 a month; Datadog Infrastructure $15 to $23 per host per month plus $1 per container.
  • Prove it: fill a volume, crash a pod, scale the app to zero. Three alerts within two minutes, and a Watchdog alert that is always firing so you know the pipeline itself is alive.

Table of contents

1. The problem

Kubernetes repairs what it can (last three posts). What it cannot repair, it reports, quietly, in places nobody reads at 22:01:

What happened Where Kubernetes said so Who was told
Node disk hung, node NotReady kubectl get nodes Nobody
40 pods evicted, 6 stuck Pending (volume attached to the dead node) kubectl get events: FailedAttachVolume Nobody
Checkout pod restarting every 40 s RESTARTS column, CrashLoopBackOff Nobody
Uploads volume 97% full since Sunday Nowhere, unless something scrapes the kubelet Nobody
The site "up" External uptime checker, hitting the CDN Everyone, wrongly

A metrics stack turns those rows into numbers that are scraped every 30 seconds, kept for weeks, graphed, and compared with rules. The rule kube_node_status_condition{condition="Ready",status="true"} == 0 for 5 minutes is a page at 22:06, not an email at 02:34.

The same 4.5 hours, with and without a metrics stack

2. Who gets hurt

Who What they lose
Customers A checkout that says "try again later" through the night. Many will not try again
The business Orders for 4.5 hours, then a morning of support tickets and a weaker "99.9%" story
On-call Woken by a customer email instead of a pager, with no graph of what changed at 22:01
Security The same blind spot hides a miner at 100% CPU, a pod pulling images from the wrong registry, or 10,000 failed logins in the ingress logs
Capacity planning No history: nobody knew the uploads volume had been filling for three weeks

3. Cost and value

What the stack costs (checked 2026-10-28):

Option Price Notes
kube-prometheus-stack (this post) $0 licence; node capacity + disk About 1.5 vCPU and 3 GB RAM on a small cluster; 50 GiB Prometheus volume + 10 GiB Grafana, about $5 to $10 a month on standard SSD
Grafana Cloud Free $0 10k active metric series, 50 GB logs, 3 users, 14-day retention. Enough for a lab or one small cluster
Grafana Cloud Pro from $19 a month 10k series included, then from $6.50 per 1k series; 13-month retention; users from $8
Datadog Infrastructure $15 Pro / $23 Enterprise per host per month (annual), $18 / $27 on-demand plus $1 per container per month; the "everything in one place" option, priced accordingly
Cloud-managed Prometheus (Azure Monitor, AWS AMP, GCP) per million samples ingested Cheap at small scale, worth a calculator at large scale; same PromQL, same Grafana

What silence costs: 4.5 hours of a dead checkout. In the lab story, at Contoso's night-time rate of about 40 orders an hour, 180 orders, plus the refunds for the carts that half-completed. The published incident hit about 200 sites, 15% of that provider's platform.

Value: the chart ships the alert rules you would have written after your third outage, on day one. The marginal cost of the fourth, fifth and hundredth metric is zero.

4. What the stack is, in five words

From my observability notes, one sentence each:

Piece Job Where it runs
Exporter (node-exporter, windows_exporter, kube-state-metrics) Turns a system into numbers on /metrics node-exporter: a DaemonSet, one per node (post 3). windows_exporter: a service on each Windows host, port 9182
Prometheus Pulls those numbers every 30 s, stores them, evaluates rules A StatefulSet with a PersistentVolume
Alertmanager Groups firing rules, routes them to email / Teams / PagerDuty, silences A StatefulSet
Grafana Draws the numbers; 30 dashboards pre-built for nodes, pods, namespaces A Deployment with a small volume
Prometheus Operator Watches ServiceMonitor and PrometheusRule objects so adding a target is a YAML file, not a config edit A Deployment

Prometheus pulls. Nothing pushes to it. If a target disappears, the up metric goes to 0, and that absence is itself an alert (TargetDown). The hardest lesson in the post-mortem above was this one: monitor the absence of good news, not only the presence of bad.

The stack: exporters on every node, Prometheus pulls, Alertmanager routes, Grafana draws

5. Install it: one chart, one values file

Helm 4 (November 2025) is the package manager; helm version should say 4.x. minikube 1.39 ships it. Then:

helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
Enter fullscreen mode Exit fullscreen mode

values.yaml, the four things worth changing on day one:

grafana:
  adminPassword: "CHANGE-ME-IN-A-SECRET"      # or existingSecret: grafana-admin
  persistence: { enabled: true, size: 10Gi }
prometheus:
  prometheusSpec:
    retention: 15d
    retentionSize: 45GiB
    storageSpec:
      volumeClaimTemplate:
        spec:
          accessModes: [ReadWriteOnce]
          resources: { requests: { storage: 50Gi } }
    # pick up ServiceMonitors / PrometheusRules from every namespace, not only the release's
    serviceMonitorSelectorNilUsesHelmValues: false
    ruleSelectorNilUsesHelmValues: false
alertmanager:
  alertmanagerSpec:
    storage:
      volumeClaimTemplate:
        spec:
          resources: { requests: { storage: 5Gi } }
Enter fullscreen mode Exit fullscreen mode
helm upgrade --install prometheus-stack prometheus-community/kube-prometheus-stack \
  --namespace monitoring --create-namespace --version 92.14.1 -f values.yaml
kubectl get pods -n monitoring
Enter fullscreen mode Exit fullscreen mode

Expect: prometheus-prometheus-stack-kube-prom-prometheus-0, alertmanager-...-0, prometheus-stack-grafana-..., prometheus-stack-kube-state-metrics-..., one prometheus-stack-prometheus-node-exporter-... per node, and the operator.

Reach it, lab style:

kubectl port-forward -n monitoring svc/prometheus-stack-grafana 3000:80
kubectl port-forward -n monitoring svc/prometheus-stack-kube-prom-prometheus 9090:9090
Enter fullscreen mode Exit fullscreen mode

Grafana: admin / the password above. Dashboards → Kubernetes / Compute Resources / Cluster is already there. In Prometheus, run up and ALERTS{alertstate="firing"}: the Watchdog alert is firing, by design, forever.

My kubeadm lab exposed this through an ingress-nginx NodePort behind an external NGINX. That controller was retired in March 2026, so for anything beyond the lab put Grafana behind a Gateway API HTTPRoute or your cloud's maintained controller, with SSO. For the lab, port-forward is the honest answer.

Grafana and Prometheus after the install: the cluster dashboard and the Watchdog alert that must always fire

6. Your app and your phone: one rule, one receiver

Scrape the shop. The web app from post 4 exposes /metrics on port 3000 (most frameworks have a one-line exporter). One object:

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: webapp
  namespace: contoso-shop
  labels: { release: prometheus-stack }
spec:
  selector:
    matchLabels: { app: webapp }
  endpoints:
    - port: http          # the Service port name
      interval: 30s
Enter fullscreen mode Exit fullscreen mode

Three rules for the shop, next to the hundred that came with the chart:

apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
  name: contoso-shop
  namespace: contoso-shop
  labels: { release: prometheus-stack }
spec:
  groups:
    - name: contoso-shop
      rules:
        - alert: ShopDown
          expr: sum(up{namespace="contoso-shop", job=~"webapp.*"}) == 0
          for: 2m
          labels: { severity: critical }
          annotations: { summary: "No webapp target is up in contoso-shop" }
        - alert: UploadsVolumeFillingUp
          expr: kubelet_volume_stats_available_bytes{namespace="contoso-shop", persistentvolumeclaim="uploads"}
                / kubelet_volume_stats_capacity_bytes{namespace="contoso-shop", persistentvolumeclaim="uploads"} < 0.15
          for: 10m
          labels: { severity: warning }
          annotations: { summary: "uploads PVC below 15% free" }
        - alert: ShopPodRestarting
          expr: increase(kube_pod_container_status_restarts_total{namespace="contoso-shop"}[15m]) > 3
          for: 0m
          labels: { severity: warning }
          annotations: { summary: "{{ $labels.pod }} restarted more than 3 times in 15 min" }
Enter fullscreen mode Exit fullscreen mode

One receiver. Alertmanager config lives in the chart values (alertmanager.config); a Teams or Slack webhook, or email through your mail relay, and a route that sends severity: critical immediately and warning every 4 hours. Keep the Watchdog alert routed to a dead-man's-switch service (several are free), so that if Prometheus itself dies, the absence of the Watchdog pages you.

7. Prove it

The Tuesday night, on purpose, in the lab:

# 1. Fill the uploads volume to 95%
kubectl exec -n contoso-shop deploy/webapp -- sh -c 'fallocate -l 9G /app/uploads/fill.bin || dd if=/dev/zero of=/app/uploads/fill.bin bs=1M count=9000'
# -> UploadsVolumeFillingUp (yours) and KubePersistentVolumeFillingUp (chart) within 10-15 min

# 2. Crash the shop
kubectl set image deploy/webapp -n contoso-shop webapp=nanajanashia/k8s-demo-app:does-not-exist
# -> KubePodCrashLooping / KubeDeploymentReplicasMismatch; roll back with kubectl rollout undo

# 3. Make the shop disappear
kubectl scale deploy/webapp -n contoso-shop --replicas=0
# -> ShopDown after 2 min, TargetDown from the chart

# 4. Kill the watcher
kubectl delete pod -n monitoring prometheus-prometheus-stack-kube-prom-prometheus-0
# -> Watchdog stops arriving at the dead-man's switch; it pages you. Prometheus is back in ~30 s with its data (StatefulSet + PVC, post 3)
Enter fullscreen mode Exit fullscreen mode

Open Alerting → Alert rules in Grafana or ALERTS{alertstate="firing"} in Prometheus and watch them light up, then clear when you undo each step.

Before and after: 4.5 hours by email, 2 minutes by pager

Gotchas

  • release: prometheus-stack label. Without it (or without the two ...NilUsesHelmValues: false settings) the operator ignores your ServiceMonitor and PrometheusRule and you think metrics are broken.
  • No persistence by default. Prometheus and Grafana data vanish with the pod unless storageSpec / persistence are set. Post 2 again.
  • Retention is size and time. Set both retention and retentionSize, or the volume fills and Prometheus stops, silently, which is the one failure it cannot alert on. Hence the Watchdog.
  • Pull means reachability. Prometheus must reach every target; a NetworkPolicy (post 2) that denies ingress from monitoring breaks scraping. Add an allow rule from the monitoring namespace on the metrics port.
  • Cardinality. One label with a user ID in it can create a million series and take Prometheus down. Labels are for dimensions, not for identifiers.
  • windows_exporter, not node_exporter, on Windows hosts (from my Windows lab); scrape it with a static target or a ScrapeConfig object. promtool check config before every change on those boxes.
  • Grafana data source URL. Inside the cluster it is http://prometheus-stack-kube-prom-prometheus.monitoring.svc:9090 (pre-wired by the chart). On my Windows lab the rule was: http://localhost:9090, not HTTPS, not 127.0.0.1.
  • Community dashboards (ID 14694 for Windows) ship with a DS_PROMETHEUS variable that must be bound to your data source, or every panel says No data.
  • ingress-nginx is retired. If your old lab notes install it via Helm, stop; use the Gateway API or a maintained controller.

Checklist

  • [ ] Helm 4, chart pinned (--version 92.14.1), values in git
  • [ ] Persistence for Prometheus (retention + retentionSize) and Grafana
  • [ ] node-exporter pod on every node, including new ones; windows_exporter on Windows hosts
  • [ ] ServiceMonitor + PrometheusRule for each app namespace, labelled for the release
  • [ ] Alertmanager receiver tested with a real page; critical vs warning routes
  • [ ] Watchdog routed to a dead-man's switch
  • [ ] NetworkPolicies allow scraping from monitoring
  • [ ] Section 7 run once a quarter; the four alerts fired and cleared

What changed recently

Checked on 2026-10-28:

  • My Helm lab used Helm 3.16 and the plain prometheus-community/prometheus chart. Helm 4 shipped in November 2025 (new plugin system, server-side apply); the richer kube-prometheus-stack chart is at 92.14.1 (2026-10-27) and bundles Grafana, Alertmanager, kube-state-metrics, node-exporter, dashboards and rules; the plain prometheus chart is at 29.39.0.
  • Prometheus 3.15.1 (2026-10-21; 3.13 is the LTS line) and Grafana 12.3 are what the chart installs; my Windows lab ran Prometheus 3.11.2, same config syntax.
  • Ingress NGINX retired March 2026; the exposure path in my Helm notes (ingress-nginx NodePort behind an external NGINX) is replaced here by port-forward for the lab and Gateway API for anything real.
  • Prices: Grafana Cloud Free 10k series / 50 GB logs / 3 users, Pro from $19 a month, series from $6.50 per 1k (grafana.com, 2026-10-28). Datadog Infrastructure Pro $15 annual / $18 on-demand, Enterprise $23 / $27, containers $1 each per month (datadoghq.com price list, 2026-10-28).
  • Post-mortem referenced: a hosting provider's 19-20 May 2026 outage, 4.5 hours undetected, no drive monitoring, CDN masked the failure. Linked below.

Sources

Cheat sheet: one chart, four pieces, three rules, the Watchdog


Thanks for reading! I'm Cuong, and on CD Security Lab I rebuild real Microsoft security cases in a safe lab and explain them simply. Follow along:

Got a question about your own tenant? Drop it in the comments.

Top comments (1)

Collapse
 
alexshev profile image
Alex Shev •

The useful alert is not merely that a pod is healthy; it is that an external user can complete the critical path. Pairing black-box probes with service-level signals catches the gap between Kubernetes status and real availability. A periodic alert test also matters, because a dashboard can be perfectly configured while its notification route has quietly gone stale.