Skip to content

CNI boot race: pods restarted before cni-install come up unregistered — no self-heal, total mesh outage after node reboot #640

Closed

Description

@bpalermo

Summary

After a whole-node (or whole-cluster) reboot, any mesh-managed pod whose sandbox is recreated before the node's cni-install finishes comes up on the base CNI with no aether registration: no traffic interception, no per-pod listeners, no registry endpoint, no mesh-DNS record. Nothing detects or repairs this — the pods stay Running and healthy per Kubernetes while being completely outside the mesh until a human rolls them.

Second occurrence: 2026-07-19 power blip (#566) and 2026-08-23 power failure. The #566/#569 fixes all behaved correctly this time (prune guard held, hysteresis + circuit breaker fine, taint lifecycle fine) — this issue is the one remaining gap: re-registration of pods that predate CNI readiness.

Timeline (2026-08-23 incident)

time (UTC) event
~12:18 power restored, all 6 nodes boot; kubelet recreates sandboxes for all bound pods 12:18–12:21 via the base (flannel) CNI — the aether chained conflist is not installed yet (ephemeral /etc/cni/net.d on Talos)
12:22:15 agent ready on worker-01; loads 13 pods from storage, all with dead pre-reboot netns paths: skipping pod with missing network namespace (stale storage; CNI DEL likely missed) (cache/listener.go:379) — same picture on all 5 workers
12:22→14:22 100% mesh data-plane outage: prober SLI ~75 rps all failures (connection_error / dns_nxdomain / timeout), zero success. Ghost sweep correctly refuses to prune (netns check failed but pod is Running per the API; not pruning, server/ghostsweep.go:322) and warns once per pod per minute — but takes no remedial action
12:33 MeshDNSResolutionFailing fires (only downstream symptom paging; see #639)
13:23 control test: freshly created pod registers cleanly — CNI ADD path fully functional once the agent is up
14:22:12 manual recovery: rollout restart of 13 aether-test deployments + ds/prober; all complete in 86 s
14:24 prober SLI back to 75 rps success / 0 failures; ghost sweep prunes the orphaned stale entries once the old pod names are gone

Total: ~2h04m of complete outage, ended only by manual intervention.

Root cause

Two boot-ordering facts compose into a silent, stable failure:

  1. The chained CNI conflist does not exist at early boot. Talos keeps /etc/cni/net.d ephemeral; the aether conflist reappears only when the agent DaemonSet's cni-install init container runs. Sandboxes recreated before that get plain flannel networking — a valid, Ready pod with no mesh.
  2. The agent-not-ready taint (node lifecycle: re-arm the agent-not-ready taint across reboots and agent outages #569) cannot cover restarts. Taints gate scheduling; a rebooting node's pods are already bound, and kubelet restarts them regardless of taints. So the taint protects new pods but not the entire pre-existing population — which after a power failure is every pod on the node.

The agent then has perfect knowledge of the broken state — startup logs every stored pod with a dead netns, and the per-minute ghost-sweep warning re-confirms it — but the only safe automatic actions today are "skip it" and "don't prune it".

Proposed fix

A. Detect-and-remediate in the agent (primary). The condition is already precisely computable on the node: Running mesh-managed pod on this node with no live registration (stale entry with dead netns, or no storage entry at all). When the agent is fully ready and the condition persists past a debounce, evict the pod (Eviction API — respects PDBs) so its controller recreates it through the now-ready CNI. Guardrails:

This converts a silent multi-hour outage into an automatic ~2-minute rolling recovery (the manual roll proved the end-state converges in <90 s).

B. Fail-closed CNI ADD for managed pods (defense in depth). Have the chained plugin return an error when the agent socket is absent and the pod is mesh-managed (#484 already skips unmanaged pods): kubelet then retries sandbox setup until the agent is up, so early-boot pods come up a few tens of seconds later but registered. Trade-off to weigh: couples pod restarts to agent health (an agent crashloop would pin managed pods down — which is exactly the fail-closed posture the taint gives scheduling, but should be a deliberate decision).

C. Make the condition page directly. Export unregistered managed pods on node as a gauge and alert on it. Today the outage paged only via the downstream mesh-DNS symptom (MeshDNSResolutionFailing), which under-notified badly (#639 covers the alerting-side gaps).

A alone fixes the incident class; A+C is the recommended scope, with B evaluated separately.

References

Activity

  1. bpalermo commented on Sep 7, 2026

    @bpalermo
    OwnerAuthor

    First production validation — 2026-09-07 power failure, mesh self-healed with zero human action

    talos-main lost power again (4th in the series). All 6 nodes cold-booted within 3 s of each other (talosctl read /proc/uptime: 15:50:48–15:50:51Z). This is the first of these events where #641's stale-while-Running eviction actually ran in anger, and it worked.

    The boot race happened exactly as described in this issue — the dead prober generation's counters pin it: liveness connection_error 5,696 at 25/s = 228 s, matching the 229 s between the first post-boot prober start (15:59:50Z) and the eviction pass. Classic fingerprint: liveness connection_error + mesh_dns dns_nxdomain, result="success" absent entirely.

    Then #641 fixed it, unaided, in 20 seconds:

    • 39 AetherCNIStaleRegistration events, 16:03:39Z → 16:03:59Z, message as shipped: "aether agent evicted this pod: its mesh registration references a defunct network namespace while the pod is Running (node-reboot CNI boot race); eviction forces sandbox recreation to re-run CNI ADD"
    • aether_agent_ghost_sweep_stale_running_evictions_total = 11 / 8 / 6 / 7 / 7 on w01..w05 = 39
    • 39 = the entire aether.io/managed=true set. Every pod recreated 16:04:00–16:04:12Z, 0 restarts.
    • Post-recovery aether_agent_storage_pods = 14/9/5/7/4 = 39, exactly matching live meshed pods per node; adding pod to storage INFO counts identical.

    Recovery timeline: nodes boot 15:50:49Z → first containers 15:59:31Z → agents up 16:01:16–16:02:45Z → evictions 16:03:39Z → SLI nominal 16:07Z. Mesh-broken-while-cluster-up was ~3.8 min, versus ~2 h on 08-23 and ~3 h on 08-29, both of which needed a human to roll 14 deployments.

    No remediation was executed. The standing runbook step "roll all aether-test deployments + ds/prober" was not needed. Post-recovery on rev208: liveness 0 errors / 31,495 requests, dns_error/dns_nxdomain/dns_timeout zero on both mesh_dns targets, latency back at the 0.3.0 baselines (mesh_dns p50 41.6 ms / p99 221.8 ms; liveness 3.14 / 20.8 ms).

    Two related mechanisms explicitly did not recur: the #645 flannel conflist clobber (flannel pods 8 d old with restartCount: 1 — containers restarted, pods not recreated, so no Talos manifest re-sync and no cp -f; aether-cni present in all 5 conflists, aether_agent_cni_conflist_chained = 1 on 5/5), and the 07-19 ghost-sweep mass-prune (no registration deficit on any node).

    Runbook consequence: on the next power event, assess for ~5 minutes before touching anything. Rolling workloads on top of a live #641 eviction pass now just adds churn. Confirm self-heal with aether_agent_ghost_sweep_stale_running_evictions_total against the managed-pod count.

    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