Alerting, DNS, & Pagerduty

· major · lasted two episodes over four days; one page lost for good

Summary

On August 11 and again on August 14, Alertmanager tried to send pages to PagerDuty and couldn’t, because it couldn’t resolve PagerDuty’s hostname. The first time, it gave up: a page about Argo CD crash-looping was never delivered. The cause was that CoreDNS, the cluster’s DNS server, ran as a single copy on one worker node, and that node restarted.

Impact

  • August 11: one alert (PodCrashLooping for Argo CD) was dropped after its retries ran out. Nobody was paged.
  • August 14: about 80 seconds of cluster-wide DNS failure. 28 notification attempts failed; all eventually got through after 8 to 12 retries each.
  • The DNS outage didn’t affect any user-facing service. The bigger problem was that alerting couldn’t be trusted: during those windows, the homelab had no way to tell me something was broken.

Detection

No alert caught it. I found it during a routine look at Alertmanager’s logs, which showed 31 failed notification attempts over two days. Every one of them was a DNS lookup failure, and PagerDuty itself never returned an error. The metric alertmanager_notifications_failed_total confirmed that two notifications had run out of retries and been dropped.

Timeline (UTC)

WhenWhat happened
Aug 11, 05:55 and 06:00Alertmanager can’t resolve PagerDuty; the Argo CD alert is abandoned after its retries
Aug 14, 19:10k3s-agent-2 restarts; the single CoreDNS pod goes with it
Aug 14, 19:10–19:11Cluster DNS refuses all queries for ~80 s; 28 notification attempts fail, then recover
Aug 15Routine log review finds the failures; investigation and fix the same day

Root cause

CoreDNS ran as one replica. k3s installs it that way by default, and I hadn’t changed it. The scheduler placed it on k3s-agent-2, which was the node most likely to fail, and that was my own doing: I had deployed Immich with no resource requests or limits. Immich’s main process used about 3.4 GB on an 8 GB node while requesting nothing, so the scheduler believed the node was 6% committed when it was really at 89%. That made it look like the emptiest node in the cluster, so it kept getting more work, including the cluster’s only DNS server.

When the node restarted, DNS went with it. Alertmanager reaches PagerDuty by hostname, so every page in flight depended on DNS, which had just gone down. The stack’s own “Alertmanager failed to send” alert couldn’t help either, since it goes out the same way.

A second gap made this invisible: the stack’s built-in heartbeat alert, Watchdog, was routed to nowhere, so nothing outside the homelab was checking that alerts could still get out.

Resolution

  • Scaled CoreDNS to three replicas, spread across the three worker nodes, so one node failing no longer takes DNS down.
  • Added a PodDisruptionBudget that allows only one CoreDNS pod to be down at a time. I used maxUnavailable: 1 rather than minAvailable: 2, because the latter would block every node drain if the replica count ever fell back to one.

What changed

  • A new alert, CoreDNSNotHighlyAvailable, fires if fewer than two DNS replicas are available.
  • A new critical alert, AlertmanagerNotificationsFailing, fires on any increase in abandoned notifications. Each increment is a page that was lost for good.
  • Immich got real resource requests and limits a day later, after it took the same node down completely (incident 020).
  • This site’s dead-man’s switch now watches the homelab from outside: if the homelab stops reporting in for five minutes, the edge opens a PagerDuty incident itself.
  • The three-replica setting is applied by hand, and CoreDNSNotHighlyAvailable alerts if a k3s restart ever resets it to one.

Lessons

  • A single DNS server is also an alerting problem. Sending a notification depends on name resolution, so while DNS is down, anything else that breaks at the same time goes unreported.
  • Retries can hide a failure. August 14 got through because the outage was shorter than the retry window. On August 11 it wasn’t, and the page was lost.
  • A pod without resource requests misleads the scheduler for everything else on the node, including critical add-ons placed next to it.
  • Check who owns a resource before changing it. A kubectl scale on something k3s manages looks like it worked and quietly reverts on the next restart.

Takeaways for a prod environment

  • Run DNS with a node-local cache (NodeLocal DNSCache) so a brief cluster DNS failure doesn’t stop name resolution at all.
  • Route the always-firing Watchdog alert to an external heartbeat service, so a broken alerting path pages someone through a different path.
  • Enforce resource requests with an admission policy, so a workload without them can’t be deployed in the first place.