Repository navigation
Description
Environmental Info:
K3s Version: observed on v1.35.4+k3s1; the code path below is unchanged in v1.37.1+k3s1
Node(s) CPU architecture, OS, and Version: x86_64, Debian GNU/Linux 13 (trixie)
Cluster Configuration: 3 servers with embedded etcd, converted to 1 etcd server plus 2 control-plane-only servers (disable-etcd: true)
Describe the bug:
Restarting an existing embedded-etcd server with --disable-etcd stops its etcd and clears its node-role.kubernetes.io/etcd label, but the node stays in the etcd member list. The remaining members keep counting it toward quorum. A check based on the node label reports the conversion as done while the member list is unchanged.
Steps To Reproduce:
- Installed K3s: 3 servers in an embedded-etcd HA cluster, all three etcd members healthy
- On server 2, add
disable-etcd: trueto/etc/rancher/k3s/config.yamland runsystemctl restart k3s. - After about 15 s,
kubectl get node -l node-role.kubernetes.io/etcd=truelists servers 1 and 3 only. - On server 1, run
etcdctl member listwith the certs in/var/lib/rancher/k3s/server/tls/etcd/.
Expected behavior:
Server 2 is removed from the etcd member list, which is what the // remove etcd member if it exists call in startEtcdProxy (pkg/cluster/cluster.go) intends.
Actual behavior:
etcdctl member list still shows 3 members. The surviving members log failed to reach the peer URL for server 2's member ID without stopping (we left it for 27 minutes). Server 2's /var/lib/rancher/k3s/server/db/etcd no longer exists afterwards. Doing the same on server 3 would leave 2 of 3 members down and lose quorum. Removing the member by hand (etcd.k3s.cattle.io/remove=true annotation or etcdctl member remove) works.
Additional context / logs:
Code references are to v1.37.1+k3s1:
pkg/etcd/etcd.gosetNamereturns early whenDisableETCDis set, soe.namestays empty on a control-plane-only server. This early return arrived with Fix restart of control-plane-only nodes attempting to reconcile from local datastore #13534 (fix for restarting services on setup with split roles causes panic in the control plane node #13533).startEtcdProxycallsRemoveSelf, which callsRemovePeer(ctx, e.name, ...).RemovePeerreturns nil at once whenname == ""("do not remove self if we have never started etcd on this node").RemoveSelfthen movesdb/etcdaside, and that directory holds thenamefile. After that, no later restart can find the old name either.
One possible fix: in RemoveSelf, when e.name is empty, read the existing nameFile before the rename and use that name for RemovePeer.
The observations come from the commands listed above, run on v1.35.4+k3s1. The code path was checked by reading the v1.37.1+k3s1 source, not by a rerun.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone Issue
Activity
brandond commentedon Oct 14, 2026
PR welcome. Preferably with a docker based e2e test, NOT a go test as Claude likes to generate.
aganesh-suse commentedon Oct 23, 2026
Closing based on: #14865
spicysharkco commentedon Oct 23, 2026
A correction to the issue text: the
etcd.k3s.cattle.io/remove=trueannotation does not remove the member once the restart has cleared the node's etcd role label, as the reproduction in #14865 also found. The member controller skips nodes without that label in both sync and onRemove, so deleting the node does not remove the member either.etcdctl member removeworks.A server converted before upgrading to a release with the fix keeps its stale member. The earlier restart already moved
db/etcd, including itsnamefile, todb/etcd-old-<timestamp>, andRemoveSelfnow reads onlydb/etcd/name. For those clustersetcdctl member removeis still needed.