Quorum is fine, zone B is dead
Postmortem for the tenant-kaas/kaas-stretch-1 sandbox, Nov 26. This is a test cluster, with no customers and no production on it. I caused the partition myself, and then it didn’t go according to plan.
We look at only one case: a non-transitive partition, where two control plane nodes can’t see each other and the third sees both.
Setup #
- Talos v1.11.5, Kubernetes v1.34.2, etcd 3.6.5, Cilium 1.18.4 (VXLAN, kube-proxy replacement), LINSTOR/DRBD 9.2.
- Three zones, emulated with
tc netem: A and B — 4 ms RTT between them, C (witness) — 6 ms to both. - Control plane:
cp-1(A, 10.20.1.11),cp-2(B, 10.20.1.12),cp-3(C, 10.20.1.13). Workers:w-a1..3in A,w-b1..3in B. cp-3 has NoSchedule. - Kubelet, Cilium and controllers reach the API through KubePrism (
127.0.0.1:7445). The apiserver on each control plane node talks to its local etcd. - etcd: heartbeat 100 ms, election timeout 1000 ms,
--pre-vote=true(the default), CheckQuorum always on. - Load: 31 non-DaemonSet pods in zone B, 6 of them with LINSTOR RWO volumes.
- Experiment: chaos-runner drops all traffic between cp-1 and cp-2 for 10 minutes. The goal is a follow-up to the PreVote article, this time on a stretched topology.
Spoiler #
PreVote and CheckQuorum worked perfectly: the leader never changed once. Zone B was taken down by KubePrism, which considered alive an apiserver that couldn’t answer a single request, and by chaos-runner, which didn’t remove the partition because it first tried to write its status through that very apiserver.
Symptom: what was green and why it lied #
| Signal | Value | What question it actually answered |
|---|---|---|
etcdctl member list | 3 started | Who is listed in the configuration, not who is receiving writes |
etcd_server_leader_changes_seen_total | 0 | Whether there was a disruption. There wasn’t, and that’s true |
| KubePrism upstream cp-2 | healthy, the fastest | Whether port 6443 accepts a TCP connection |
| chaos-runner pod | Running, Ready | Whether the process is alive, not whether it did its job |
| Cilium datapath in zone B | working | Whether traffic flows according to the last known state |
Timeline (Nov 26, +01:00) #
| Time | Event |
|---|---|
| 14:02:00 | chaos-runner applied the nft table kaas-chaos on cp-1 and cp-2, TTL 10 min |
| 14:02:02 | cp-2 doesn’t hear the leader, becomes pre-candidate. cp-3 rejects the PreVote, term stays at 7 |
| 14:02:09 | First etcdserver: request timed out from the apiserver on cp-2 (7 s) |
| 14:02:12 | The kube-controller-manager leader on cp-2 failed to renew its lease |
| 14:02:24 | kube-controller-manager on cp-3 took leadership |
| 14:02:52 | Zone B: cp-2, w-b1, w-b2, w-b3 — NodeStatusUnknown, taint unreachable:NoExecute |
| 14:07:52 | The 300 s tolerationSeconds expired, 23 pods marked for deletion |
| 14:12:00 | Partition TTL expired. chaos-runner goes into Status().Update retries and never gets to the rollback |
| 14:17:52 | [FIRING:4] KubeNodeNotReady (for: 15m) |
| 14:18 | Acknowledged, looking |
| 14:24 | Bet on the zone B network. Lost: the Cilium datapath is alive |
| 14:29 | Exec through the cp-3 apiserver: the kaas-chaos table is still there |
| 14:33 | etcdctl snapshot save from cp-1, kaas-operator token for 30 minutes |
| 14:34:00 | nft delete table inet kaas-chaos on cp-1 and cp-2 |
| 14:34:02 | cp-2 caught up with the leader via snapshot in 1.8 s |
| 14:35:10 | Zone B Ready, [RESOLVED] |
| 14:39 | Last pods with RWO volumes started |
| 15:01 | Data checks finished, incident closed |
Layer by layer #
1. chaos-runner: the partition that didn’t go away #
What broke. The table is still in place 22 minutes after the TTL:
kvaps@kaas-sandbox:~$ kubectl --context kaas-stretch-1 --server https://10.20.1.13:6443 \
-n kaas-chaos exec chaos-node-7xq2k -- nft list table inet kaas-chaos
table inet kaas-chaos {
chain input {
type filter hook input priority filter - 10; policy accept;
ip saddr 10.20.1.11 drop
}
chain output {
type filter hook output priority filter - 10; policy accept;
ip daddr 10.20.1.11 drop
}
}
Exec through cp-1 doesn’t work: the cp-1 apiserver can’t reach the kubelet on cp-2. Hence --server pointing at cp-3.
Why. The runner’s reconcile woke up on time via RequeueAfter, at 14:12:00. Its first step was writing status.phase: Reverting, the second was deleting the rule. The runner pod lived on w-b2, its requests went through KubePrism to cp-2, and Status().Update failed with a timeout. Error, backoff, timeout again. It never got as far as deleting the rule. In effect, the partition was protecting itself.
What we did. Deleted the table by hand. Then in tym83/kaas (PR #12) we changed the order: idempotent rollback first, status second. And most importantly: the address now lives in an nft set with a timeout, so the rule expires in the kernel on its own:
nft add set inet kaas-chaos peers '{ type ipv4_addr; flags timeout; }'
nft add element inet kaas-chaos peers '{ 10.20.1.11 timeout 10m }'
nft add rule inet kaas-chaos input ip saddr @peers drop
Cost. The runner can no longer extend a partition on the fly, only recreate the set element. For chaos tests that’s fine.
Verification. Repeated the run on Nov 27 with the runner pod killed at the third minute. The set element expired exactly after 10 minutes, and connectivity came back without the controller’s involvement.
2. etcd and Raft: the only thing that worked as designed #
What we saw.
kvaps@kaas-sandbox:~$ etcdctl --endpoints=10.20.1.11:2379,10.20.1.12:2379,10.20.1.13:2379 \
endpoint status -w table
+-----------------+------------------+---------+---------+-----------+-----------+------------+--------------------+
| ENDPOINT | ID | VERSION | DB SIZE | IS LEADER | RAFT TERM | RAFT INDEX | RAFT APPLIED INDEX |
+-----------------+------------------+---------+---------+-----------+-----------+------------+--------------------+
| 10.20.1.11:2379 | 6f1a2c0e9b3d4a17 | 3.6.5 | 42 MB | true | 7 | 61904 | 61904 |
| 10.20.1.12:2379 | 2b8e47d1c05f9e63 | 3.6.5 | 42 MB | false | 7 | 48211 | 48211 |
| 10.20.1.13:2379 | a40c93f6e2d17b58 | 3.6.5 | 42 MB | false | 7 | 61904 | 61904 |
+-----------------+------------------+---------+---------+-----------+-----------+------------+--------------------+
Meanwhile member list showed all three as started. Configuration and actual state had drifted apart by 13,693 entries.
Why. cp-2 doesn’t hear the leader’s heartbeat and after the election timeout becomes a pre-candidate. PreVote doesn’t increment the term, and cp-3 rejects it: with CheckQuorum, a follower that has recently heard from the leader doesn’t vote for a new election. cp-1 and cp-3 are a majority, so the leader stays. Without PreVote, cp-2 would bump the term and depose the leader every time connectivity came back. On raft-lab that produced 41 leader changes in 10 minutes. This isn’t a bug, it’s a direct consequence of how Raft works.
But cp-2 has no leader, so any request through it is doomed. A linearizable read requires a ReadIndex from the leader. A write is forwarded to the leader, and cp-2 can’t reach it. Both cases end after 5 s + 2 × election timeout = 7 s with etcdserver: request timed out.
What we did. Nothing: after the partition was removed, cp-2 was further behind than the number of entries the leader keeps after the last snapshot, so it received a snapshot (42 MB, 1.8 s) and caught up. We took a snapshot from cp-1 before intervening, just in case.
Cost. Zero. This is a deliberate choice in Raft: here safety matters more than availability of a member in the minority.
Verification. All three members have the same RAFT APPLIED INDEX, etcdctl check perf passed, etcd_server_leader_changes_seen_total = 0 for the whole incident.
3. apiserver on cp-2: a live port, dead responses #
What broke. /livez green, /readyz red:
kvaps@kaas-sandbox:~$ curl -sk https://10.20.1.12:6443/readyz?verbose | grep -v ok
[-]etcd failed: reason withheld
[-]etcd-readiness failed: reason withheld
readyz check failed
Why. The apiserver on cp-2 talks only to its local etcd. The watch cache doesn’t fail: it stops receiving events, and watches simply go silent. For cp-2’s clients the world froze, but stayed consistent. Lists with consistent reads from the cache ask etcd for the current revision and fail after the same 7 seconds. This is only a hypothesis from reading the code; I haven’t measured it separately.
What we did. Nothing on the sandbox. The target fix is in layer 4.
Cost / verification. —
4. KubePrism: the fastest backend that doesn’t work #
What broke. All four zone B nodes kept sending requests to cp-2:
kvaps@kaas-sandbox:~$ talosctl -n 10.20.3.31 get kubeprismendpoints -o yaml | yq '.spec.addresses'
- 10.20.1.12
- 10.20.1.11
- 10.20.1.13
Why. KubePrism distributes requests across live upstreams and prefers the one with lower latency. An upstream counts as live if it accepts a TCP connection. Port 6443 on cp-2 is open and answers in 0.3 ms versus 4 and 6 ms for the others. The balancer was faithfully picking the fastest backend that doesn’t work. In normal operation it’s an optimization; during a partial partition it’s a trap.
What we did. In the kvaps-lab/cozystack-drift fork, branch vision/apiserver-endpoint-selection (release v1.7.0-kvaps.2): a local load balancer for the apiserver that excludes a backend after two consecutive failed /readyz checks and brings it back after three successful ones, taking the zone into account. We’re not touching upstream Talos until a human has looked at it and until we’ve checked whether this is already solved there.
Cost. An extra /readyz request once per second from every node to every apiserver: with 9 nodes and 3 apiservers that’s 27 rps, negligible. If /readyz fails on all three at once, the balancer really should fall back to the TCP check, otherwise we cut ourselves off from the API.
Verification. Run 3 on the demo on Nov 27: zone B kubelet leases went through cp-3, failover in 3.1 s, NotReady — 0.
5. Kubelet and node lifecycle: eviction with healthy nodes #
What broke. The zone B nodes were alive, but their leases weren’t being renewed. After ~50 s the node lifecycle controller marked them Unknown and applied unreachable:NoExecute.
Why. Zone B went into FullDisruption entirely, while zone A stayed healthy. In this mode eviction in zone B proceeds at the normal rate: this is exactly the “we lost a site” scenario. The controller doesn’t know the site is alive and only the path to the API is broken. The kube-controller-manager leader also happened to be on cp-2 (coincidence) and handed leadership to cp-3 after 12 s. All of that is as expected.
What we did. Nothing; once the API came back, the leases were renewed and the taint was removed on its own.
Cost. 23 pods marked for deletion. The zone B kubelets didn’t know about it, so 17 old Deployment replicas ran for 32 minutes in parallel with the new ones in zone A. For stateless workloads that’s harmless. For anything that holds a lock or writes to a queue, it isn’t.
Verification. After 14:35:10 the kubelet saw the deletionTimestamp and finished off the old replicas within 40 s.
6. Cilium: datapath alive, control plane blind #
What broke. cilium status on w-b1:
kvaps@kaas-sandbox:~$ kubectl --context kaas-stretch-1 --server https://10.20.1.13:6443 \
-n kube-system exec cilium-9fd4m -- cilium status | head -3
KVStore: Disabled
Kubernetes: Warning [Get "https://127.0.0.1:7445/healthz": context deadline exceeded]
Kubernetes APIs: ["EndpointSliceOrEndpoint", "cilium/v2::CiliumEndpoint", ...]
Why. The agent keeps the datapath on the last known state, and that’s the right design: traffic within and between zones kept flowing. But it didn’t see new EndpointSlices, so clients in zone B kept going to the old pod replicas in zone B, while clients in A went to the new ones. That’s exactly why my first bet on the network lost: the network had nothing to do with it.
What we did / cost. Nothing. Fixed by layer 4.
Verification. After the API came back the agent caught up on events in 4 s, cilium-health status — all nodes reachable.
7. Storage and StatefulSet: the right kind of slow #
What broke. 4 Deployment pods with RWO volumes were stuck in ContainerCreating with Multi-Attach error, and 2 StatefulSet pods weren’t recreated at all.
Why. The old pods are formally Terminating, and the VolumeAttachment on the zone B node isn’t released until the kubelet confirms the unmount. A StatefulSet doesn’t create a replacement until the old pod is deleted: at most one. This isn’t a bug; it’s precisely what saves you from two writers on one volume.
What we did. Nothing. We didn’t force delete: the DRBD replicas in zone B were Primary, and data matters more than speed, even in a sandbox.
Cost. 4 minutes after the zone came back (until 14:39).
Verification. linstor r l — all resources UpToDate, drbdsetup status --verbose — not a single split-brain, checksums of the test tables matched.
Scenario matrix #
Runs on raft-lab and kaas-stretch-1, 10-minute cp-1↔cp-2 partition:
| PreVote | Balancer check | Runner order | Leader changes | Zone B without API | Evictions |
|---|---|---|---|---|---|
| false | TCP | status → rollback | 41 | 10 min | yes |
| true | TCP | status → rollback | 0 | 32 min (partition not removed) | 23 pods |
| true | TCP | rollback → status + nft timeout | 0 | 10 min | 23 pods |
| true | /readyz + zone | rollback → status + nft timeout | 0 | 3.1 s | 0 |
Numbers #
- Zone B without API: 32 min 10 s. With endpoint-selection on the same run: 3.1 s.
- etcd leader changes: 0. cp-2 lag: 13,693 entries, caught up in 1.8 s.
- 23 pods marked for deletion, 17 ran as two copies for 32 minutes, 6 with volumes waited up to 4 minutes after the zone came back.
- Data loss: 0.
What it can’t do yet #
- Endpoint-selection hasn’t been tested with five control plane nodes or with a partition where
/readyzflaps. The 2/3 hysteresis was picked by eye. - If
/readyzfails on every apiserver, the balancer currently falls back to TCP. Whether that’s right for stretched clusters is not fully known. - Node lifecycle still can’t tell “the site died” from “the site’s path to the API died”. I don’t have a target solution yet.
- The behavior of consistent list from the cache on a lagging member is a hypothesis from the code, not a measurement.
Action items #
| What | Owner | Status |
|---|---|---|
| chaos-runner: rollback before status, nft set with timeout | kvaps | done, tym83/kaas PR #12 |
EtcdMemberNoLeader alert: etcd_server_has_leader == 0 for more than 30 s on any member | kvaps | done, fork v1.7.0-kvaps.1 |
Alert on a RAFT APPLIED INDEX difference between members greater than 1000 | kvaps | in progress |
Endpoint-selection by /readyz and zone | kvaps | in fork v1.7.0-kvaps.2, demo in the kaas tenant |
| Check whether upstream Talos already has this; design issue only after approval | sandbox maintainer | waiting |
| Run chaos-runner in zone C, not in the zone it’s breaking | kvaps | done |
| “Partial partition” runbook: exec through the apiserver of a live zone, snapshot before intervening | kvaps | done |
UPD Nov 27: run 3 repeated with the runner pod killed — the nft set element expired on its own after 10 minutes.