Skip to content

mesh-dns: build a dedicated slim binary for the daemon instead of reusing the full /agent #583

Closed

Description

@bpalermo

Problem

The aether-mesh-dns DaemonSet runs command: ["/agent"] args: ["mesh-dns", …] — i.e. it ships and executes the entire agent binary (controller-runtime, xDS/go-control-plane, CNI server, GAMMA/L4 reconcilers, SPIRE, …) just to serve a small in-process DNS resolver fed by a snapshot file.

Why it matters (talos rev 180 / chart 0.85.0)

Proposal

Add a dedicated minimal binary (e.g. //agent/cmd/mesh-dns or reuse the existing subcommand wired into its own slim go_binary) containing only: the meshdns resolver, snapshot read + fsnotify reload, resolv.conf upstream defaulting, and telemetry. No controller-runtime, no xDS, no k8s client (the daemon already needs no API access — it's fed by the file the agent writes).

  • Shrinks the binary and RSS toward the resolver's true footprint (target ~5–8Mi), and makes any exec-based health check cheap (complements/eases mesh-dns: replace exec-marker readiness probe with in-process /healthz (reclaim ~250m fleet CPU) #582).
  • Smaller image + attack surface for a component that binds a host port and is reached by every pod's :53 DNAT.
  • Keep the shared snapshot schema + serviceref <ns>/<svc> keying + c-ares semantics (EDNS0 echo, NODATA-for-non-A, authoritative never-forward) in the shared Go packages so the daemon and the agent (which WRITES the snapshot) can't drift — just don't drag the whole agent into the daemon image.

Scope

  • New slim go_binary target + its own container image (distroless), or a Bazel-sliced build of the mesh-dns entrypoint.
  • charts/aether/templates/mesh-dns-daemonset.yaml: point command/image at the slim binary; the meshDnsDaemon image ref may need its own digest-pinned entry. Chart version bump.
  • Gazelle/BUILD wiring; keep agent mesh-dns subcommand working (or retire it if fully replaced). Tests unchanged (same meshdns package).

Context

Follows #578 (decouple). Surfaced while assessing a Go→Rust rewrite (rejected — a slim Go binary captures most of the resource win at far lower cost/risk than a second language on this correctness-sensitive path). Pairs with #582 (in-process /healthz probe); together they let meshDnsDaemon.resources drop well below the current 300m/128Mi (inflated only for the re-exec).

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