Skip to content

mesh-dns: close the observability gaps (snapshot staleness, log shipping, forward-path blindness) #586

Closed

Description

@bpalermo

Now that the resolver is a standalone DaemonSet on the critical path for every managed pod's DNS (the CNI DNATs all UDP+TCP :53 to HOST_IP:18054), its observability is inadequate. Audit + live verification against talos.

Verified state

Metrics work, but there is only one. aether.mesh_dns.queries (counter, single result attribute: answered/nxdomain/cold/forwarded/forward_error) — agent/internal/meshdns/metrics.go:20-48. It reaches Prometheus correctly per-node (node="main-worker-0X", promoted from host.name). No latency, no gauges, no per-upstream, no runtime metrics. Repo-wide, this metric is consumed by nothing — no dashboard, no alert.

Logs are shipped nowhere. agent/internal/meshdns/telemetry.go installs a MeterProvider only — no LoggerProvider. The otel-collector has only an otlp receiver (no filelog), and no log-collector DaemonSet exists. So mesh-dns logs exist only as pod stdout and are lost when the pod is replaced — i.e. on every roll. This matters because several failure modes' only signal today is a log line.

The forward path is unexercised and unwatched: live counters show forwarded=6 per node vs answered≈380,000. The prober's mesh_dns tier only resolves mesh names, which are never forwarded — so kube-dns health and upstream failover have zero coverage.

P1 — snapshot staleness is completely invisible

The daemon serves from a snapshot file the agent writes (agent/internal/xds/cache/capture.go:129). If the agent crashes, loses RBAC, or its capture reconciler wedges, no fsnotify event fires and the daemon serves the frozen table forever: new services never resolve, re-IP'd services resolve to dead ClusterIPs, and since ready is true those misses are authoritative, negatively-cached NXDOMAINs (server.go:368). The daemon has no Kubernetes access by design and cannot cross-check. The external prober stays 100% green throughout, because its long-lived target keeps resolving from the stale snapshot.

mtime alone is insufficient: the writer is event-driven (no SyncPeriod; default resync 10h), so a healthy quiet cluster would look stale.

P1 — empty upstreams = silent total DNS outage (bug, not just observability)

NameserversFromResolvConf returns nil on any read error (resolvconf.go:16-18); the caller logs upstreams=[] at INFO and proceeds (cmd/mesh-dns/main.go:130-132). Every non-mesh query then becomes forward_error. Since all pod :53 traffic is DNAT'd here, that is a full DNS outage for cluster.local + external, announced at info level.

Scope (one PR)

  1. Snapshot freshness: versioned envelope {writtenAt, generation, records} (tolerate the legacy bare map on read); agent re-writes on a ~60s heartbeat even when unchanged; daemon exports aether.mesh_dns.snapshot_age_seconds + aether.mesh_dns.snapshot_written_at_seconds (observable gauges).
  2. Record/reload health: aether.mesh_dns.records gauge (catches an empty snapshot NXDOMAIN-ing the whole mesh), aether.mesh_dns.snapshot_reloads_total{result=success|read_error|parse_error|missing}, aether.mesh_dns.watch_active gauge.
  3. Ship logs via OTLP — add a LoggerProvider to the daemon. Do not import common/telemetry/setup: bazel query somepath shows it reaches controller-runtime and would undo the slim binary (mesh-dns: build a dedicated slim binary for the daemon instead of reusing the full /agent #583). Mirror logs.go's light deps (otlploggrpc + sdklog) locally.
  4. Empty-upstreams fix: promote to ERROR + aether.mesh_dns.upstreams_configured gauge.
  5. Cheap adds: aether.mesh_dns.query.duration histogram {result}, aether.mesh_dns.ready gauge, Go runtime metrics (runtime.Start()), and NODE_NAME fieldRef so k8s.node.name is the node name not the IP (cosmetic today, but wrong).

Deliberately deferred to follow-ups

Wedge/liveness detection (REUSEPORT makes a network probe ambiguous — see #580); a non-mesh prober target to cover the forward path; dashboards + alerts (none exist); mesh-DNS runbook section (docs/runbook.md has zero DNS content); qtype/proto split; the UDP-only forward client truncating TCP-originated queries.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions