Skip to content

kube-flannel pod recreation clobbers the chained aether-cni conflist entry (Talos manifest re-sync) — silent fleet-wide unmeshing #645

Closed

Description

@bpalermo

Summary

cni-install appends the aether-cni plugin entry to flannel's 10-flannel.conflist once, from an init container. kube-flannel's own init container does cp -f /etc/kube-flannel/cni-conf.json /etc/cni/net.d/10-flannel.conflist — an unconditional overwrite from its ConfigMap template — every time a flannel pod is (re)created. Whenever that happens after cni-install has run, the aether entry is silently stripped fleet-wide: the plugin binary stays on disk but is unchained, no CNI ADD ever reaches the agent, and every subsequently-started pod runs outside the mesh.

Observed 2026-08-29 (third power-blip incident): not triggered by the boot race (#640). Talos re-applied its bundled bootstrap manifests (node-fetch field manager) at 19:01:09Z — ~37 min after apiserver came up — which updated the kube-flannel DaemonSet and rolled all 6 pods (restartCount 0, fresh pods). Each node's conflist mtime matches its new flannel pod's init container to the second. Result: plugins=[flannel, portmap] on all 5 workers, total mesh outage that workload rolls could not fix (a replacement pod just goes through plain flannel again), and one that #641's eviction self-heal also cannot fix (evicting an unmeshed pod yields another unmeshed pod).

Why this is NOT power-event-specific

Talos re-syncs its bootstrap manifests on boot, on talosctl apply-config, and on Kubernetes upgrades. Any of those recreates the flannel pods and clobbers the chain. aether appends once; flannel overwrites on every re-sync. aether always loses eventually.

Detection gap

Nothing watches the conflist. The failure presented only as downstream symptoms (prober SLI 100% failure, ghost sweep "live mesh pod missing from local storage" warnings). The #641 gauge (unmeshed_pods) will at least page on the consequence once deployed, but the sweep's eviction remediation is actively counterproductive here — it churns pods without fixing anything (consider suppressing eviction retries for a pod already evicted once for the same cause, or detecting the unchained-conflist condition directly).

Fix shape

Appending into a file that another DaemonSet cp -fs can never be made safe. Options, strongest first:

  1. Standalone 05-aether.conflist (own file, sorts before 10-flannel.conflist, no competing writer) — requires the aether conflist to be self-sufficient (delegate/chain to flannel from aether's file, or use a type: aether-cni top-level plugin that wraps the delegate) since kubelet uses only the lexicographically-first conflist. Needs design: the current entry is a chained plugin inside flannel's list.
  2. Re-assert loop in the long-running agent: watch /etc/cni/net.d (fsnotify, same machinery as agent/storage) and re-append the entry whenever it goes missing; log + metric each re-assert. Simple, keeps the chained model, closes the window to seconds. Can ship independently of (1) and is the pragmatic first step.
  3. At minimum: a gauge/alert "aether-cni present in active conflist" per node.

(2) + (3) recommended now; evaluate (1) as the structural fix.

Incident context

Activity

  1. bpalermo commented on Sep 2, 2026

    @bpalermo
    OwnerAuthor

    Fix shape 1 (05-aether.conflist): recommend closing as won't-fix — superseded by a better mechanism

    Design exploration done (2026-09-02). Summary of why the standalone file is the wrong structural fix, and what to do instead.

    Why not 05-aether.conflist

    kubelet uses only the lexicographically-first valid conflist, so aether's file would have to contain the entire chain — including a copy of flannel's plugin config. That means:

    1. It does not remove the competing writer, it changes the watcher's job. flannel keeps rewriting 10-flannel.conflist forever, so aether must still watch it — but the watcher goes from "re-append one entry into someone else's file" (small, idempotent, fails open) to "maintain a full mirror of someone else's network config in a file I am now authoritative for" (stateful, fails closed). More machinery, bigger blast radius, to shrink a ~2.5s window.
    2. The failure mode inverts, and gets worse. Today's bug leaves pods running but unmeshed. A stale authoritative copy — after flannel is replaced, or Talos changes its bundled manifest across a k8s upgrade — pins the node to a chain whose plugin binary may not exist, so no pod can start on that node at all. The trigger list for that (boot, apply-config, k8s upgrade) is exactly this issue's trigger list.
    3. Uninstall becomes dangerous. Nothing guarantees removal (preStop is skipped on force-delete/node crash; helm uninstall runs no node-side code). Ironically, flannel's cp -f — the cause of this issue — is currently aether's uninstall cleanup: it strips a fail-closed orphaned entry and heals the node. A 05- file removes that safety valve.
    4. Rollback trap: roll the agent back to a pre-05- version and nothing deletes the file; the old code re-appends into 10-flannel.conflist, which the runtime no longer reads, the gauge reads 1, and the node is silently pinned to a frozen chain.
    5. 05- sorting first is a convention, not a guarantee — any 00-/01- file silently wins.

    The better mechanism, if we do this at all

    CNI spec 1.1.0 sibling plugin-conf directory. NetworkConfFromFile also loads <netdir>/<network-name>/*.conf and appends them to the chain unless loadOnlyInlinedPlugins: true (spec §"loadOnlyInlinedPlugins"; libcni/conf.go NetworkPluginConfsFromFiles). For Talos flannel that is /etc/cni/net.d/cbr0/.

    This gives fix shape 1 everything it wanted with none of the ownership risk: aether owns its own file, flannel stays authoritative for its own config (nothing is mirrored), a flannel config change is picked up automatically, aether lands after the inlined plugins (exactly where it is today), and if the runtime does not support it the result fails open — aether simply unchained, which the existing gauge already reports.

    Gated on two runtime facts, deliberately not verified during a soak window:

    • the libcni version vendored into containerd on the Talos nodes (NetworkPluginConfsFromFiles landed in cni v1.2.0; containerd 1.7.x vendors v1.1.x, containerd 2.x vendors v1.2.3+);
    • whether containerd's CNI conf-dir fsnotify watch fires on writes into a subdirectory.

    Both are answerable with one canary: drop a harmless /etc/cni/net.d/cbr0/99-probe.conf on one node and see whether it runs.

    Two cheaper things worth more than either option

    Filed separately as #667: with the agent down, a flannel roll strips the entry and nothing repairs it — and cni_conflist_chained goes absent, not 0, so the alert cannot fire, while the taint gate (os.Stat on the socket) still lets the node accept pods. Result: silently unmeshed pods. That is this issue's failure mode reduced to one node and made invisible.

    Correction to this issue's text

    The claim that #641's eviction is counterproductive no longer holds post-#650: the ghost sweep evicts after ~3 consecutive 60s passes, by which time the conflist has been repaired for ~3 minutes, so the replacement pod comes up meshed. #650 and #641 compose correctly.

    Recommendation

    Close fix shape 1 as won't-fix/superseded; keep the re-assert loop as the accepted answer for the chained model (validated in production 2026-09-02: strip → repair in ~2.5s); do #667 first; and open the sibling-directory work as its own issue only after the canary answers the two runtime questions.

  2. bpalermo commented on Sep 5, 2026

    @bpalermo
    OwnerAuthor

    Closing — the structural work this was left open for has landed, and the last comment already retired the standalone-conflist fix shape as superseded:

    Residual, tracked outside this issue: the prime-after-process-restart path of #689 is proven by unit tests but not yet exercised on a node (needs talosctl/kubectl debug, denied in the automation session), and #696 (cni-install's ctrl.Log is unbound, so its "wrote the durable entry" line never reaches stdout).

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