Skip to content

agent: every local pod ADD/DEL rewrites every mesh cluster → all clusters re-warm 15 s → node-wide upstream pool drain (the SHRINK's 18 timeouts) #815

Closed

Description

@bpalermo

Split out of #799. Under investigation (an xDS-focused analysis is running; its report will be posted here).

Observation

The agent already detects the condition and only observes it: agent/internal/xds/cache/inboundidentitybinding.go logs WARN inbound chain references a secret absent from the snapshot. A pod's inbound listener is generated at CNI ADD; its SVID arrives later over the SPIFFE Broker stream (1.7–7.6 s under load, 60–391 ms on a quiet cluster), so every pod start publishes a chain whose secret does not exist yet.

Why it matters

8-hour soak, 2026-09-19, rev218: the harness scaled aether-test/svc-5 4→0→4. Restore at 07:03:01Z → that WARN on w01/w04/w05 at 07:03:03Z (…/sa/svc-5) → 18 prober timeouts fleet-wide at 07:03:20–22Z (w05 9, w03 4, w02 3, w01 1, w04 1) — 43 % of the run's errors and its largest episode. The victims were requests to echo, not svc-5: access logs show only DC/downstream_remote_disconnect from the prober (263–1440 ms) with the paired DR/http2.remote_reset at echo; no UF/UH/URX/UO/NR; upstream hosts on three nodes. So it is not "traffic to a pod without a certificate" — something on the node stalls unrelated requests for a moment. The 20 s gap between the WARN and the timeouts is unexplained.

The same WARN fires on a plain agent restart (3× for one pod, 0.1 s after its resubscribe, 2026-09-19 12:09:58Z).

Possibly the same mechanism

main-worker-05's prober timed out 1.5–2.5 min after 4 of 18 service Deployment rolls in that soak (svc-5 ×2, svc-1, svc-4): client-side deadline expiries again, on the hottest proxy (812m CPU vs 506m on w01). 9 of the run's 42 timeouts.

Candidates being examined

Listener warming on an absent SDS secret and what it blocks; CDS/EDS ordering under SotW ADS when an upstream TLS context's secret is absent; one full snapshot regeneration per pod ADD and per SVID arrival (N pods → ≥2N SetSnapshot calls); the demand-scoped dependency set dropping and re-adding clusters (#682).

Fix shapes to evaluate

(A) hold a pod's inbound listener / its HEALTHY promotion until its SVID is served — the interlock the agent already applies to its own identity; (B) coalesce snapshot publication per batch; (C) gate only the registry promotion. Constraints: SPIRE down must not make pods unreachable forever; --spire-enabled=false stays byte-identical; UDS-delivery pods; the health gateway; hot restart; the #638 discriminator's assumptions.

Activity

  1. added
    bug
    on Sep 19, 2026
  2. changed the title [-]agent: a pod's inbound chain reaches Envoy before its SDS secret; 18 prober timeouts when svc-5 scaled back up[/-] [+]agent: every local pod ADD/DEL rewrites every mesh cluster → all clusters re-warm 15 s → node-wide upstream pool drain (the SHRINK's 18 timeouts)[/+] on Sep 19, 2026
  3. bpalermo commented on Sep 19, 2026

    @bpalermo
    OwnerAuthor

    Root cause (analysis 2026-09-19) — the title's original theory was wrong

    The listener-before-secret window is real but benign; what cost the traffic is next to it and worse.

    1. The ordering window — confirmed, bounded, low severity

    • SnapshotCache.AddPod publishes the inbound listener at CNI ADD; SubscribePod is asynchronous, so the listener always precedes its secret (same on agent restart). SDS source is a bare {ads:{}}, no initial_fetch_timeout (Envoy default 15 s); ADS is DELTA_GRPC.
    • Measured 07:03Z: the secret landed 6.1–8.4 s after the listener on the four nodes that got a svc-5 pod; envoy_listener_manager_total_listeners_warming = 1 on exactly those nodes for one 5 s scrape, 0 on w03. One warming listener — the pod's own; it blocks nothing else. While warming, Envoy has bound the socket but not called listen(): a connect gets ECONNREFUSED. On timeout it goes active without a certificate and self-heals when the secret lands.
    • One real hole: the liveness loop promotes an endpoint HEALTHY on the health gateway alone, which has no SDS dependency. Promotion p50 was 5.8 s vs a 6.1–8.4 s SVID, and one svc-5 pod promoted in ≤0.5 s. An endpoint can be advertised HEALTHY while its inbound port refuses connections. It did not bite here (no UF), but it is the only fail-open in the area.

    2. What actually caused the 18 timeouts

    Falsification of the WARN theory: the harness's scale-DOWN at 07:01:31Z produced the same fleet-wide latency excursion at T+19 s with no WARN, no new listener and no warming; and 15 of the 18 WARNs in the 8 h run had no prober error at all.

    Mechanism:

    1. Every local pod ADD/DEL rewrites every mesh cluster on the node: recomputeMTLSClusters → proxy.InjectUpstreamMTLS builds a transport_socket_matcher.exact_match_map keyed by the source pod's netns path (proxy/transportsocketmatch.go). New test: 9 of 9 service clusters change bytes on one unrelated pod ADD and revert on the DEL. Production: cluster_manager.cluster_modified 42–66 per node per 20 min against 3 adds/removes.
    2. Envoy rebuilds each changed cluster into warming_clusters_.
    3. Delta-xDS trap: the rebuilt EDS cluster registers a watch for a name the old cluster still watches, so no EDS request is sent and no CLA arrives (delta does not re-send unchanged resources) → every rebuilt cluster warms for the full 15 s EDS initial_fetch_timeout.
    4. At T+15 s the swap destroys the old ClusterEntry on every worker → drainConnPools() on every upstream pool on the node; hosts are new objects, pools are keyed by host pointer → the next request to every endpoint pays a fresh TCP + mTLS handshake.
    5. That handshake storm is the excursion. In-flight streams are not reset, which is why the access logs show latency and DC (prober's 2 s deadline) and no UC/UF.

    The 20 seconds: first post-event snapshot 07:03:02.8 (w02) / 07:03:03.4 (w01) + 15 s = 07:03:17.8 / 18.4 → first DC 07:03:18.255 / 18.281. Scale-down: 07:01:32–37 + 15 s → excursion 07:01:50–51. w05's dep-set expiry 07:04:34.8 + 15 s → the only cds_update_failure of the window at 07:04:40–50.

    Why echo: the drain hits every cluster, not svc-5's — the spike shows on echo, svc-1…4 from all five nodes with flat offered load and fleet proxy CPU +30 % for exactly those buckets.

    Empirical confirmation (added by the main session): envoy_cluster_manager_warming_clusters at 5 s resolution across the phase-3 soak's svc-4 burst (+4 pods, 15:01:56Z):

    node new pods warming clusters for
    main-worker-02 2 30–33 30 s (15:02:00 → 15:02:30)
    main-worker-03 1 24 15 s
    main-worker-05 1 27 15 s
    main-worker-01, -04 0 0 —

    Every cluster on a node warms for exactly 15 s per pod ADD, and two ADDs chain to 30 s. That is steps 1–3 observed directly, on the current build (rev220).

    The w05 "latency after service rolls" pattern is the same defect: a Deployment roll is a stream of ADD/DELs, each arming another 15 s re-warm and a node-wide pool drain.

    3. Fix

    • Primary — make the Cluster proto byte-stable across pod churn. The matcher is keyed by netns path (unique per pod) but selects by SPIFFE ID (per ServiceAccount). Stamp the source pod's SPIFFE ID into filter state as a literal (buildSetFilterState already takes an inline string) and key the matcher on that: a pod of an already-present ServiceAccount then changes no cluster and Envoy does nothing. Two-release rollout — ship listeners setting BOTH filter-state keys first, then switch the cluster matcher; in one step a cluster with the new input facing a listener with only the old key falls to OnNoMatch = node identity = wrong client certificate (feat(agent): log outbound identity bindings on change and flag foreign-identity binds (#638) #686 territory).
    • Secondary — close the promotion hole: "the pod's SDS secret is in the snapshot" as a precondition for the FIRST promotion to HEALTHY; no-op with SPIRE disabled.
    • Instrumentation first: watch cluster_manager.warming_clusters, *_update_failure, listener.*.ssl_context_update_by_sds, downstream_context_secrets_not_ready; set an explicit initial_fetch_timeout so 15 s is chosen rather than inherited. Consider whether a short EDS initial_fetch_timeout is a cheap interim mitigation (it shortens the warm, not the drain).
    • Rejected: holding the inbound listener until the SVID arrives (the port already refuses while warming; adds a way to make pods unreachable on the ADD path); debouncing snapshots alone (one push still rebuilds every cluster — worth doing after the primary fix, not instead).

    4. Still inferred

    The delta-EDS no-request step (2.3) is a source-level reading of WatchMap::updateWatchInterest / NewGrpcMuxImpl::updateWatch; the 15 s warm itself is now measured. An un-ACKed CDS nonce for 15 s with LDS/EDS ACKed would be the last fingerprint. Envoy's own stderr does not cover 07:03Z.

    Tests (local branch investigate/sds-listener-ordering, commit f88a2cf, not pushed): TestSnapshotRegenerationIsANoOpPush, TestLocalPodChurnRewritesEveryServiceCluster.

  4. bpalermo commented on Sep 19, 2026

    @bpalermo
    OwnerAuthor

    Plan agreed with Bruno (2026-09-19), replacing the "secondary" item above:

    Promotion gate = a TLS readiness probe, not an agent-side "secret is in the snapshot" check. HEALTHY should depend on what Envoy has actually loaded, so the health gateway will require TWO per-pod probe clusters to pass: the existing app probe (health_<pod>, cleartext to the app) AND a new one that completes an mTLS handshake against the pod's own inbound listener (node identity as the client certificate, SAN match = the pod's SPIFFE ID, TCP health check — Connected fires only after the handshake). The gateway's health_check filter already takes a map in cluster_min_healthy_percentages. That fails while the listener is still warming (connect refused), while the secret is not loaded (handshake reset), if the SVID expires unrotated — and if the chain ever presents a DIFFERENT identity (#638), the pod simply never becomes healthy: fail-closed per pod instead of observed after the fact. Kept separate from the app probe on purpose: an HTTP probe through the inbound chain would traverse inbound RBAC / ext_authz with the node as source, and would not work for TCP-floor or UDS-delivery pods. Skipped entirely with SPIRE off (byte-identical config).

    Main risk to validate on a cluster before it ships: after a proxy hot restart the new Envoy epoch must load SDS before the TLS probe passes — the liveness loop's warm-up grace has to cover that or every proxy roll flaps the node UNHEALTHY.

    Release one (in progress): listeners stamp BOTH filter-state keys (netns path + source SPIFFE ID literal), clusters byte-identical; plus the TLS readiness probe. Release two: switch the cluster matcher to the SPIFFE-ID key (ends the every-pod-event cluster rewrite). Release three: drop the netns key.

  5. bpalermo commented on Sep 19, 2026

    @bpalermo
    OwnerAuthor

    Release one (#819) FAILED its live validation — rolled back, revert PR open

    talos-main, rev221 → rev222 (0.92.27-89061d1), 2026-09-19 17:30:14 → 17:32:44Z. Rolled back 17:41:15 → 17:43:16Z (helm rev223 = 0.92.26-fba248c); the four affected services were back at 4/4 healthy endpoints at the first reading after it.

    What broke

    main-worker-03 — permanent demotion (proof item 2 failed, and not in the predicted way). The four service pods on the node were promoted 17:31:26Z, demoted HEALTHY→UNHEALTHY at 17:31:56–17:32:02Z and never re-promoted (still 0/5 inboundready healthy at 17:40Z). Fleet-wide, svc-1…4 dropped 4 → 3 endpoints; no alert fired; the prober saw nothing because echo has no pod on that node.

    Cause, measured: w03's Envoy subscribed to SDS secrets named with an empty trust domain — envoy_sds_spiffe_ns_aether_test_sa_{svc_1,svc_2,svc_3,svc_4,prober}_init_fetch_timeout_total = 1 each, update_attempt = 1, no update_success (the healthy form is envoy_sds_spiffe_aether_internal_ns_…). The agent never serves spiffe:///ns/…, so the inbound listeners came up with no certificate and the probe could not connect (no ssl_fail_verify_san, no ssl_connection_error — nothing to handshake with). The agent logged 15 × inbound chain bound to a foreign identity with bound_spiffe_id: spiffe:///ns/aether-test/sa/<sa> at 17:31:22.4Z — 0.8 s AFTER resolved workload trust domain from SPIRE trustDomain=aether.internal (17:31:21.618Z). So listeners were generated from a trust-domain value that was still empty although the identity holder already had it: an ordering bug in listener generation, prime suspect #819's new currentTrustDomain() read of the cache's own copy in the regeneration paths (generateCaptureListener, gamma.go's NewInboundListener) — if the cache's copy is set later than the holder's, anything regenerated in between gets spiffe:///. No such envoy_sds_spiffe_ns_* series exists in the previous 24 h (six rolls), so this is new with #819, or at least newly reachable.

    Note what the gate did here: the pods' inbound mTLS was genuinely broken (no certificate), and the gate correctly refused to call them healthy. Without the gate they would have been advertised HEALTHY and failed every mTLS connection. The gate is not the bug; the empty trust domain is — but the combination turns a broken listener into a permanently stranded endpoint with no signal.

    main-worker-05 — gate silently absent. No inboundready_* series at all, while its health_* clusters export normally and its node SVID had been served (17:31:00Z). The gate reverted to the app probe alone and nothing said so.

    What passed

    CDS-delivered STATIC cluster with ADS-sourced SDS initialises (no NACK, no proxy restart); the stats exclusion is right (membership_* and ssl.* exported, dead subtrees not); the one-time listener update was hitless (0 prober errors, all nodes); 0 NR 404s on this roll (control-tested against the 30 from rev221 → #817 did not recur). On the three healthy nodes the hysteresis held through the proxy roll.

    Not measured (the STOP condition fired first)

    The SVID → inboundready → promotion timeline (so TCP-HC-over-TLS == "handshake done" is still NOT ESTABLISHED), the new promotion delay, and the release-two "before" warming_clusters measurement.

    To re-land

    1. Never publish an inbound chain, a probe cluster or the new filter-state key with an empty trust domain: one source of truth for the trust domain, and a test that regenerates listeners between "holder resolved" and "cache updated".
    2. "This probe has never completed a handshake in this Envoy epoch" is can't-tell, not unhealthy — fail open for already-served pods, closed only for first promotion; and log at WARN when a pod is held un-promoted by the TLS probe.
    3. Find why w05 emitted no probe clusters with a served node SVID; make "gate absent" visible (a gauge of pods with/without the gate).
    4. Alert: endpoints demoted and not re-promoted within N minutes (aether_agent_liveness_health_transitions_total had no HEALTHY→UNHEALTHY series at all before this).
    5. Validate with a proxy roll on EVERY node and a service with a pod on every node as the prober target — the prober was structurally blind here.
  6. bpalermo commented on Sep 19, 2026

    @bpalermo
    OwnerAuthor

    Decision (Bruno, 2026-09-19): fix forward on top of #819; revert PR #820 closed (branch kept as a fallback). main is NOT deployable until the fix lands — talos-main runs 0.92.26 (helm rev223). The fix is in progress: root-cause the empty trust domain from the w03 startup log (and the w05 no-probe case), give the TLS probe its own gateway path so the liveness loop can treat 'never passed in this epoch' as can't-tell for pods that already served (hard precondition only for the FIRST promotion), make the gate's presence observable, and seed the health-transition counters.

  7. bpalermo commented on Sep 19, 2026

    @bpalermo
    OwnerAuthor

    Release one is LIVE and validated — talos-main rev224 (0.92.27-0f2b6c4 = #819 + #821), 2026-09-19

    Upgrade 18:58:23 → 19:00:42Z; then a svc-4 burst, a deliberate proxy DaemonSet roll (19:06:00 → 19:07:56Z, all five nodes), a deliberate agent DaemonSet roll (19:08:28 → 19:09:55Z) and a throwaway pod on a brand-new ServiceAccount. echo was scaled 3 → 6 for the run so the prober had a target on every worker (the failed run was blind to the broken node).

    No STOP condition fired. count({__name__=~"envoy_sds_spiffe_ns_.*"}) returned no data at every 5 s step; 0 foreign-identity WARNs and 0 occurrences of spiffe:/// across 10 agent startups; health_transitions_total{HEALTHY→UNHEALTHY} seeded at 0 on all five nodes and 0 at every sample through the deploy, the proxy roll and the agent roll; per-service endpoint membership flat except for deliberate scaling. Prober: no non-success series of any class, +4,800 successes on all 15 series (live, not blind). 0 ERROR lines, 0 restarts, no alert fired.

    The exact losing interleaving re-occurred and was harmless — main-worker-02, first agent roll:

    18:59:24.140  listener.go  generating listeners
    18:59:24.531  gamma.go     service chain filters updated   ← inside the load
    18:59:24.688  listener.go  generated listeners
    

    0 WARNs, correct spiffe://aether.internal/… SDS names, 8/8 probes healthy, 0 demotions. (1 occurrence in 10 startups.)

    Gate presence: every agent logged promotion gate ACTIVE … gated_pods=N with N == storage_pods (17/8/7/7/6); inbound_gate_pods{ungated} = 0 and inbound_gate_held_pods = 0 on all five nodes at every sample; w05 emitted its probe clusters this time. sum(inboundready healthy) per node was flat through the whole proxy roll — no dip at 10 s resolution.

    TCP health check over TLS = a real handshake: confirmed on mechanism. envoy_cluster_ssl_handshake_total{inboundready_<pod>} increments exactly +1 per 5 s HC interval on every probe cluster, and membership_healthy flips 0 → 1 in the same 5 s bucket as the first handshake on all five new pods. No pod was promoted before its SVID was served (5/5). Order SVID < probe healthy ≤ promotion is clean on 3 pods; on 2 (both on w02) the agent's promotion precedes the first handshake as observed through the 5 s OTLP export, while the agent reads Envoy live over the gateway and held_pods stayed 0 — not resolvable at this resolution, not called an inversion. To settle it: log each probe path's status per liveness pass.

    Promotion delay: p50 5.03 s, max 15.0 s, min 4.99 s (pre-#815: p50 5.8 s / p90 7.2 s, with one pod promoted in ≤ 0.5 s — that fail-open outlier is gone). Values sit on multiples of the 5 s HC interval.

    Release-two "before" baseline (cluster_manager.warming_clusters, 5 s step, svc-4 4 → 8 at 19:02:11Z): w02 (2 new pods) 30 clusters for 30 s; w03 (1) 20 for 15 s; w04 (1) 24 for 15 s; w01/w05 (0) zero. Identical to the rev220 measurement — release one does not touch this, as designed. Release two (switch the cluster matcher input to aether.source.spiffe_id) is what removes it; every originating listener on talos-main now stamps that key.

    Not exercised: the "held un-promoted" row and the can't-tell fallback (no pod was ever held > 60 s; the brand-new-ServiceAccount pod got its SVID in 4.3 s), so those remain unit-tested only; ssl_connection_error / upstream_cx_connect_fail for inboundready_* have no series, so "the probe visibly fails while warming" is inferred from membership_healthy = 0.

    Traps for whoever grades this next: the malformed metric NAMES from the 17:32Z incident stay in Prometheus' name index forever — grade from a live count(), never from name listing. A transient promotion gate NOT active … gated_pods=0 ungated_pods=0 missing="no trust domain yet" line before ACTIVE is startup with no pods loaded, not a fail-open. gated+ungated can read 1 below storage_pods for ~45 s while a deleted pod's storage record is pruned.

  8. bpalermo commented on Sep 19, 2026

    @bpalermo
    OwnerAuthor

    Release two is LIVE and validated — talos-main rev225 (0.92.28-e4af095, #822), 2026-09-19

    Upgrade 20:33:47 → 20:36:18Z on top of release one. No STOP condition fired; not rolled back.

    The measurement (envoy_cluster_manager_warming_clusters, 5 s step)

    svc-4 4 → 8 at 20:39:28Z — the same event that was measured on rev224:

    node case rev224 rev225
    main-worker-03 same-ServiceAccount ADD 20 clusters / 15 s 0
    main-worker-04 same-ServiceAccount ADD 24 / 15 s 0
    main-worker-05 same-ServiceAccount ADD 27 / 15 s (rev220) 0
    main-worker-01 no new pod 0 0
    main-worker-02 FIRST svc-4 pod on the node — 30 / 15 s, expected

    DEL side: a node that lost one of two svc-4 pods → 0; the node that lost both → one wave. svc-1 Deployment roll: nodes where the ServiceAccount stayed present → 0 (this used to cost every cluster twice); first-ever svc-1 pod on w01 and last one leaving w04 → one wave each; prober delta 0 — this is the event that used to produce timeouts 15 s–2 min later. Brand-new ServiceAccount (r2-canary on w03): exactly one 23-cluster wave on ADD, one on DEL, nothing on the other four nodes.

    SHRINK re-measured (svc-5 4 → 0 → 4): one wave per node per direction instead of one per pod, 0 prober errors, no DC lines — this step cost 18 timeouts on rev218.

    What still re-warms, measured: first pod of a ServiceAccount arriving on a node, last one leaving, and a registry change to a cluster (that cluster alone).

    The risk: no connection took the no-match path

    • The stats_tags regex took: the family is envoy_cluster_match_count_total{aether_cluster, aether_transport_socket_match, node} (Prometheus' OTLP ingest moves "total"); no metric name carries a SPIFFE ID; total envoy_* metric names went 854 → 837 (five name-mangled per-ServiceAccount families from rev224 collapsed into one).
    • The on_no_match identity on a node agent is the agent's own SVID, spiffe://<td>/ns/aether-system/sa/aether-agent — NOT spiffe://<td>/node/<node>. The query in the runbook/PR (=~"spiffe://[^/]+/node/.*") therefore returns a FALSE ZERO; caught live by the platform session. Fix in progress.
    • With the right selector: in a quiet 4-minute window the no-match increase is exactly 0 on all five nodes while workload matches climb normally (prober 10/s); during the svc-4 burst the only no-match increments sat entirely on the aether-test/svc-4 cluster (host construction on its EDS change — the documented floor), 0 on the other 13 clusters. Identity set per node identical before and after. Transient cross-service mTLS identity mis-binding during concurrent proxy-restart + service roll (failed closed) #638/feat(agent): log outbound identity bindings on change and flag foreign-identity binds (#638) #686 mismatch counters 0; no envoy_sds_spiffe_ns_*; 0 foreign-identity WARNs; authz canary decisions unchanged (its OPA input shows …/sa/authz-canary as source).
    • Limit: the destination-side check the plan called for could not be run — the OTLP access-log format has no peer-identity field (no XFCC, no %DOWNSTREAM_PEER_URI_SAN%). The OPA metadata is source-side, a weaker control. Filed separately.

    Rolls under the new matcher

    Deliberate proxy DaemonSet roll (20:52:25 → 20:54:08Z) and agent DaemonSet roll (20:54:12 → 20:55:38Z): prober delta 0, zero HEALTHY→UNHEALTHY, gate ACTIVE on all five nodes afterwards (ungated 0, held 0). 0 ERROR lines (control-tested). No alert fired.

    One finding on the deploy's own roll (not the matcher)

    main-worker-01's prober logged 36 connection_error (6 liveness + 15 + 15 mesh-DNS) in one ~1.4 s window at ≈20:36:0xZ while EnvoyNotLive was pending on w01; warming_clusters on w01 was 0 at every 5 s sample, so it is not the re-warm path — it is the proxy pod handoff. Filed separately. Also expected and seen once per node: the one-time re-key as each agent came up (w02 30 clusters ≈50 s, w05 24 ≈40 s).

    Remaining for #815

    Release three (drop the netns filter-state key from the listeners) — only once no supported upgrade path can pair release-two clusters with pre-release-one listeners. The "held un-promoted" / can't-tell rows of release one's gate remain unit-tested only.

  9. bpalermo commented on Sep 19, 2026

    @bpalermo
    OwnerAuthor

    Proposed alert rules for the series releases one and two added

    All four series verified present on all five nodes of talos-main at 21:18Z (rev225), including both transition directions seeded at 0 — so none of these is a rule over a name that does not exist. Thresholds are first proposals; the two marked tune need a week of observation. The rules belong in the GitOps repo (k8s-talos-main) — posting them here so the reasoning lives with the change that created the series.

    # 1. A pod's inbound mTLS cannot be proven, for minutes. THE rev222 signature.
    #    On rev222 four endpoints were demoted and never re-promoted with no alert at
    #    all; under the current build that state is "held", not demoted, and this is
    #    what it looks like. Nonzero briefly at every pod start is normal.
    - alert: AetherInboundGateHeld
      expr: aether_agent_liveness_inbound_gate_held_pods > 0
      for: 5m
      labels: {severity: warning, component: aether-agent}
      annotations:
        summary: "{{ $labels.node }}: {{ $value }} pod(s) held by the inbound-readiness gate"
        description: >-
          Their inbound listener has no usable certificate (SDS secret unserved or the
          wrong identity). Already-serving pods keep serving; NEW pods are not promoted.
          Check the agent log for `inbound-readiness gate held` and see runbook §"A pod
          never becomes routable".
    
    # 2. The promotion gate is not in effect on a node. The rev222 w05 failure:
    #    the gate silently absent, so nothing was verifying inbound mTLS at all.
    - alert: AetherInboundGateInactive
      expr: aether_agent_liveness_inbound_gate_pods{aether_gate_state="ungated"} > 0
      for: 10m
      labels: {severity: warning, component: aether-agent}
      annotations:
        summary: "{{ $labels.node }}: {{ $value }} mesh pod(s) with no inbound-readiness gate"
        description: >-
          The agent logs one line per start saying ACTIVE or NOT active with the missing
          precondition. Endpoints there are promoted on the application probe alone.
    
    # 3. Endpoints demoted and not coming back (any cause, not just the gate).
    - alert: AetherEndpointsDemotedNotRecovered
      expr: |
        sum by (node) (increase(aether_agent_liveness_health_transitions_total{
            aether_health_from="HEALTH_HEALTHY",aether_health_to="HEALTH_UNHEALTHY"}[15m]))
        - sum by (node) (increase(aether_agent_liveness_health_transitions_total{
            aether_health_from="HEALTH_UNHEALTHY",aether_health_to="HEALTH_HEALTHY"}[15m])) > 0
      for: 10m
      labels: {severity: warning, component: aether-agent}
      annotations:
        summary: "{{ $labels.node }}: {{ $value }} endpoint(s) demoted and not re-promoted in 15m"
    
    # 4. An SDS secret name with an EMPTY trust domain. The rev222 outage signature.
    #    Should never exist. NOTE: the malformed metric NAMES from 2026-09-19 17:32Z
    #    linger in Prometheus' name index forever, so this MUST be a live count(),
    #    never a check for the name's existence.
    - alert: AetherMalformedSpiffeSecretName
      expr: count({__name__=~"envoy_sds_spiffe_ns_.*"}) > 0
      for: 2m
      labels: {severity: critical, component: aether-agent}
      annotations:
        summary: "Envoy is subscribing to SDS secrets with an empty trust domain"
        description: >-
          The agent built listeners before the trust domain was known (#815/#821).
          Those listeners never get a certificate. Check for the agent WARN
          `inbound chain bound to a foreign identity` with `spiffe:///`.
    
    # 5. **tune** Connections not carrying aether.source.spiffe_id, so the cluster
    #    matcher falls to on_no_match and the pod presents the AGENT's identity.
    #    Two traps, both hit on 2026-09-19: the family is match_count_total (not
    #    total_match_count), and the no-match identity is the agent's own SVID, not
    #    spiffe://<td>/node/<node> — a /node/ selector is a false zero.
    #    Floor: host construction resolves once per host on every EDS change, so this
    #    is nonzero during churn. Measured: 0 over a quiet 4 min; ~120/5min on ONE
    #    cluster during a pod ADD. A real leak tracks the connection rate (the prober
    #    alone is 10/s = 6000/10min), so the threshold is far above the floor.
    - alert: AetherClusterIdentityNoMatch
      expr: |
        sum by (node) (increase(envoy_cluster_match_count_total{
          aether_transport_socket_match="spiffe://aether.internal/ns/aether-system/sa/aether-agent"}[10m])) > 1000
      for: 15m
      labels: {severity: warning, component: aether-proxy}
      annotations:
        summary: "{{ $labels.node }}: outbound connections are selecting the node identity"
        description: >-
          Workload traffic is presenting the agent's certificate instead of the pod's.
          Expected only transiently on an upgrade that skipped a release (#815 upgrade
          order). Cross-check with the OPA decision log's aether.source.spiffeId.

    Not proposed, deliberately: a rule on envoy_cluster_manager_warming_clusters. It is legitimately 20–30 for 15 s whenever the first pod of a ServiceAccount lands on a node, and that is now rare enough to be noise rather than signal; the thing worth alerting on (the drain's effect) is already covered by the prober SLI.

  10. bpalermo commented on Sep 19, 2026

    @bpalermo
    OwnerAuthor

    Corrections to the rules above, from the platform side implementing them (k8s-talos-main#109, draft) and evaluating them against the live Prometheus — three are fixes to my expressions, one is a measurement that invalidates my threshold:

    1. node!="" on every selector. Convention in those rule groups: a source without k8s.node.name resurrects the collapsed fleet-wide series and makes the sum lie (the fix(telemetry): per-node identity for static infra cluster stats (agent_xds) #210 lesson).
    2. > 0.5, not > 0, in AetherEndpointsDemotedNotRecovered. increase() extrapolates, so two equal counts can differ by a fraction and the rule would flap on nothing.
    3. That rule has a blind spot worth writing down: a pod START counts as UNHEALTHY→HEALTHY (57 of them in a 2 h window against 0 demotions), so during a roll the re-promotions can mask a genuine demotion for the whole window. AetherInboundGateHeld is the rule that actually catches the rev222 shape; this one is the backstop for causes the gate cannot see.
    4. My no-match threshold of 1000/10m is too tight. Measured during the rev225 deploy's own rolls: 768 per 10 m per node — a deliberate proxy roll sits within 1.3× of the threshold, so the rule would page on maintenance. Either raise it (~3000/10m keeps it below a real leak: a leak moves the whole connection rate, and the prober alone is ~10/s) or, better once there is a week of data, express it as a ratio of no-match to total matches, which is roll-insensitive because workload matches climb during a roll too. Leaving it as a tuning item rather than guessing again.

    Also noted from their side: counters that only exist once non-zero (the authz ext_authz_error/timeout family) need a "present now, absent 10 m ago" second half, because increase() reads a counter's first appearance as 0 — the same false-zero family as the two traps above.

  11. added a commit that references this issue on Oct 4, 2026
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions