Skip to content

agent startup is fatally coupled to OTel export: a shedding collector crash-loops agents and takes out a node's xDS #662

Closed

Description

@bpalermo

Summary

The node agent's startup hard-depends on the OTel collector accepting exports. When the collector is shedding (data refused due to high memory usage), the agent's export blocks past its startup deadline, the startup context is cancelled, SPIRE Workload API source creation fails, and the process exits 1 — so the agent crash-loops and the node loses its xDS control plane. A telemetry backend under memory pressure should never be able to stop the data plane from starting.

Observed live on talos-main during the 2026-09-02 soak (rev189/0.91.3-d22cf05), on 3 of 5 nodes during a rolling restart:

starting aether agent
exporter export timeout: rpc error: code = Unavailable desc = data refused due to high memory usage
ERROR failed to shutdown telemetry: context canceled
Error: failed to create SPIRE Workload API source: context canceled

Kubelet on the same nodes: Readiness probe failed: .../readyz: context deadline exceeded → Liveness probe failed → Container agent failed liveness probe, will be restarted.

Restart counts at 06:08Z: w05 0, w01 0, w03 1, w04 2, w02 5 and still 0/1 CrashLoopBackOff — i.e. it does not reliably self-recover while the collector stays saturated; worker-02 sat with no agent for minutes. It recovered only after the soak load was torn down and collector pressure fell.

Why this is a product defect, not just an o11y incident

The collector saturation had an external cause (see context below), but the coupling is ours:

  1. Blocking startup on a telemetry export makes an observability component a hard dependency of the data plane. The agent programs Envoy; if it cannot start, that node's mesh config goes stale and new pods on it get no listeners.
  2. The failure is correlated across the fleet. Every agent exports to the same collector, so a shedding collector can take out every node's agent at once — precisely during a rolling restart, when they all start simultaneously. This is the same class of fleet-wide correlated failure as agent: ghost-sweep prune needs a mass-delete circuit breaker (power-blip incident 2026-07-19) #566/CNI boot race: pods restarted before cni-install come up unregistered — no self-heal, total mesh outage after node reboot #640.
  3. It converts back-pressure into a crash loop. Shedding is the collector working as designed (memory_limiter); the correct agent response is to degrade telemetry, not to die.

Expected behaviour

Telemetry must be best-effort and off the startup critical path:

  • Never block agent startup on a successful export. Initialize the exporter asynchronously, or bound it with a short timeout whose expiry is logged and otherwise ignored.
  • Failure to export must not cancel the startup context used by SPIRE/xDS/CNI initialization. (The visible error is failed to create SPIRE Workload API source: context canceled — the telemetry failure is cancelling an unrelated dependency's context, which suggests one shared context where two are warranted.)
  • Consider whether readyz should depend on telemetry at all; a node agent that can program Envoy but cannot export metrics is degraded, not unready.

Where to look

agent/internal/cmd/root.go startup sequence (telemetry setup vs SPIRE source creation and their shared context), and common/telemetry/setup/. Check the OTLP exporter's configured start/export timeout and whether the error path is fatal.

Repro

Saturate the collector (or point the agent at a collector returning Unavailable/ResourceExhausted), then restart the agent DaemonSet. Expect: agents fail startup and crash-loop. Desired: agents start, log a telemetry warning, and serve xDS.

Context

  • Collector was at 729Mi/675Mi against a 1Gi limit, well above the ~563MiB soft shedding threshold (limit% − spike% = 80% − 25%), with OtelCollectorRefusingData firing and unresolved from 04:14Z onward.
  • Root trigger of the saturation was node pressure on main-worker-01 (which hosts Prometheus, Alertmanager, Tempo, etcd, spire-server, Pyroscope and the soak harness's single echo replica) — tracked separately; it is the trigger, not the defect.

Activity

  1. bpalermo commented on Sep 5, 2026

    @bpalermo
    OwnerAuthor

    Deliberately reproduced the shedding condition — the fix holds. PASS.

    Four soaks never got the collector above ~22% of its memory limiter, so #668's decoupling was "not disproven", not proven. Today it was exercised on purpose with the e2e/pressure harness (#690) against the production collector on talos-main (rev194, cc44d69), 2026-09-05 14:14–14:16Z.

    Pressure: telemetrygen flooding the logs pipeline at ~96 MiB/s aggregate. memory_limiter (80/25 on a 2Gi limit, GOMEMLIMIT 1638MiB) engaged at 14:15:09Z: otelcol_receiver_refused_metric_points_total +8,784, refused_log_records +995, collector RSS 1,644MiB. This is the same "data refused due to high memory usage" state that on 09-02 crash-looped 3 of 5 agents (w02 reached 6 restarts) and cost a node its xDS.

    Under that condition the harness deleted the agent on main-worker-03:

    pod deleted 14:15:09Z (aether-agent-wrnhf)
    replacement created 14:15:25Z (aether-agent-9qjms)
    waiting for the SPIRE Workload API to issue this agent's SVID 14:15:30.237Z
    resolved workload trust domain from SPIRE 14:15:30.343Z
    local storage is ready, starting manager 14:15:30.436Z
    CNI conflist re-assert loop started 14:15:30.521Z
    Ready 14:15:41Z — 16s after creation
    restartCount 0 (re-checked 14:16Z)
    failed to create SPIRE Workload API source absent
    CrashLoopBackOff absent
    worker taints [] on all five

    The only ERROR-level line in the new agent's log is registrar/registrar.go:463 failed to start watch stream, retrying — rpc error: code = Canceled desc = context canceled at 14:15:30.929Z, which the client retried and recovered from on its own. It is not on the startup critical path and it is not the #662 failure (filed separately as a small observation). The harness graded FAIL on it because its criterion is "any ERROR containing context canceled", which is broader than #662's signature — being fixed in the harness (follow-up issue).

    Conclusion: agent startup is decoupled from OTel export under real collector shedding. SPIRE source creation, storage readiness and the manager start all completed while the collector was refusing data; telemetry export failure is best-effort as #668 intended.

    Also observed, for the record: the collector itself survived four floods today with peak RSS 1,743MiB (85% of the 2Gi limit, above GOMEMLIMIT) and 0 restarts — memory_limiter sheds rather than OOMs, as designed. And the limiter's trigger is on Go heap (~1,126MiB), which corresponds to RSS ≈1,250–1,650MiB depending on GC phase; every soak record's "≈1126MiB soft threshold vs RSS" comparison has been conservative by that ratio.

    Closing. Runs: harness runs 1–4 in this session (run 1 under-powered at 64 MiB/s, runs 2–3 aborted on the harness's RSS ceiling after shedding had in fact engaged per Prometheus, run 4 with the ceiling at 1,850MiB produced the observation).

  2. bpalermo commented on Sep 7, 2026

    @bpalermo
    OwnerAuthor

    Same failure shape, different dependency: agent startup is also fatally coupled to the SPIRE Workload API (observed 2026-09-07)

    #668 fixed the OTel-export coupling, and it held — there was no OTel-driven crash loop in this event (otelcol_receiver_refused_metric_points_total increase over the window: 0; collector RSS 262/260 MiB). But the 2026-09-07 talos-main power failure reproduced exactly this issue's shape against a different startup dependency, so recording it here rather than losing it.

    All 6 nodes cold-booted 15:50:48–15:50:51Z. Every agent then crash-looped 2–3 times. kubectl logs --previous is identical on all of them:

    INFO  cmd/root.go:206 "starting aether agent" nodeName=main-worker-01 ...
    INFO  cmd/root.go:335 "waiting for the SPIRE Workload API to issue this agent's SVID"
          socket=/run/secrets/workload-spiffe-uds/socket timeout=25000000000
    Error: failed to create SPIRE Workload API source
          (socket /run/secrets/workload-spiffe-uds/socket): context deadline exceeded
    

    (w01 and w03 show context canceled, w05 context deadline exceeded — same path, different race point.)

    Restart counts per node: w01 3, w02 1, w03 3, w04 3, w05 4. The agent hard-exits (exit code 1) when the 25 s SVID wait expires, so the node has no xDS and no CNI registration server until CrashLoopBackOff happens to retry after SPIRE is up.

    Upstream cause — and it is a third occurrence of its own pattern. spire-server-0 crashed twice with a fatal plugin-configure error:

    level=error msg="Failed to configure plugin" plugin_name=aws_kms plugin_type=KeyManager
      error="... operation error STS: AssumeRoleWithWebIdentity, exceeded maximum number of attempts, 3,
      https response error StatusCode: 400, RequestID: f287b2a8-...,
      InvalidIdentityToken: Couldn't retrieve verification key from your identity provider ..."
    level=error msg="Server crashed" ...
    

    The IRSA OIDC issuer is served by this cluster (irsa namespace, irsa.palermo.dev HTTPRoute), so at cold boot spire-server races its own OIDC provider, and aws_kms treats the transient 400 as fatal. spire-server only became healthy at 16:00:35Z; agents came up 16:01:16–16:02:45Z. Same family as the 2026-08-29 spire-server IRSA-injection race — "SPIRE depends on something that isn't up yet at boot" has now bitten three times.

    Impact was bounded (it is self-limiting — backoff eventually wins, and #641's eviction pass then re-meshed everything by 16:03:59Z, full SLI recovery 16:07Z), but it adds ~60 s to every node's post-boot mesh readiness and burns 2–4 restarts per agent on every power event, which is precisely the cost #662/#668 set out to remove.

    Suggests the #668 treatment generalises: no external dependency should be able to turn agent startup into a process exit. Waiting for the SVID with retry-in-place, rather than Error: → exit 1, would make a cold boot a slow start instead of a crash loop. Filing as a new issue if you'd rather track it separately — flagging here first because it is the same defect class this issue named.

    Full record: project_incident_power_failure_20260907.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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