Skip to content

etcd: Error: unhealthy cluster after removing a node

Kubernetestested on kubeadm, Kubernetes v1.37

After replacing a control-plane node, etcdctl reports an unhealthy cluster. Before you intervene, find out whether the old member still belongs to the cluster or is only still in your endpoint list.

Symptom

sudo -E etcdctl endpoint health -w table 2>&1 | tail -5
| https://172.16.0.126:2379 |   true |  42.376051ms |                           |
| https://172.16.0.228:2379 |   true |  58.660385ms |                           |
|  https://172.16.0.83:2379 |  false | 5.001356785s | context deadline exceeded |
+---------------------------+--------+--------------+---------------------------+
Error: unhealthy cluster

The third endpoint does not answer within five seconds. The other two are healthy.

Diagnosis

Look at the cluster's member list – it is what counts, not the endpoint list.

sudo -E ETCDCTL_ENDPOINTS=https://172.16.0.126:2379 etcdctl member list -w table
+------------------+---------+------+---------------------------+---------------------------+------------+
|        ID        | STATUS  | NAME |        PEER ADDRS         |       CLIENT ADDRS        | IS LEARNER |
+------------------+---------+------+---------------------------+---------------------------+------------+
| 33764b6962314e3f | started |  cp1 | https://172.16.0.126:2380 | https://172.16.0.126:2379 |      false |
| 6292e5989e4c860b | started |  cp2 | https://172.16.0.228:2380 | https://172.16.0.228:2379 |      false |
+------------------+---------+------+---------------------------+---------------------------+------------+

Causes

two members, both healthyOnly the environment variable is stale

kubeadm reset already removed the old node's etcd member. unhealthy cluster only appears because ETCDCTL_ENDPOINTS still contains the old address.

corpse in member listOld member never removed

If reset did not run or the node is dead, the member stays. etcd then keeps counting three members, and a second failure costs the quorum.

Fix

Remove an orphaned member by its ID before a new node joins. If it is already gone, etcd says so.
sudo -E ETCDCTL_ENDPOINTS=https://172.16.0.126:2379 etcdctl member remove cf664b54c8c1c3e0
Error: etcdserver: member not found

Don't: Let the new node join first and remove the old member afterwards. The other way round, etcd briefly has four members and needs three for the quorum.

▶
Break it yourself and find it – free
Kubernetes Day 2, Day 12: replace a control-plane node – reset, etcd member, token and certificate key.
Go to day 12 →

FAQ

What does “member not found” mean when removing?

The member is already gone, for example because kubeadm reset removed it. Then there is nothing left to do.

How many etcd members may fail?

With three members, one. The quorum is the majority – which is why every corpse in the member list counts.

Related error patterns

More