Skip to content

3. EtcdMember CR without an etcd member (stale CR)#

Symptom. etcd no longer lists the host as a member, but its EtcdMember CR still reports Joined=True or carries no status. One of the following verdicts appears:

  • left etcd, CR isn't updated (VerdictLeftCRNotUpdated): MKE removed the member successfully, but the CR status update was lost. This verdict clears on its own and requires no action.
  • oob etcd member removal, stale EtcdMember CR (VerdictOOBRemovalStaleCR): The member was removed from etcd outside of MKE, and the CR is now stale. Continue with the resolution in this section.
  • CR status never written (VerdictCRStatusNeverWritten) on a CR that carries no status: Resolve this verdict the same way as VerdictOOBRemovalStaleCR. Do not use the k0s restart in CR status unusable, because the host might not run k0s, and a removed member cannot resolve its own member ID.

The discriminator is spec.leave plus MKE's own annotation, not spec.leave alone. MKE stamps mke.mirantis.com/leave-requested-by-mkectl with the member's hex ID before it removes anything, so a CR carrying that stamp for this member's ID is MKE's own removal even when spec.leave has gone back to false — the target's k0s clears spec.leave on every start:

kubectl get etcdmember <node-name> \
  -o jsonpath='leave={.spec.leave} memberID={.status.memberID} stamp={.metadata.annotations.mke\.mirantis\.com/leave-requested-by-mkectl}{"\n"}'

The <annotation-name> annotation holds a stamp in the form <hexID>@<timestamp>. Compare only the hex ID, which is the part before the @, against status.memberID.

If you are running mkectl node add, the verdict does not affect the action:

  • The host runs k0s: Refer to §2.
  • The host does not run k0s: Delete the CR manually, as described in the repair procedure below. The host is not part of the cluster, so there is no removal to re-run.

Otherwise, determine the verdict from the CR state:

  • spec.leave is true, or the annotation hex ID equals status.memberID: The CR is in the VerdictLeftCRNotUpdated state. This state is expected and does not indicate an anomaly. Re-run mkectl node remove. At the end of the removal flow, mkectl runs a second cleanup pass, CleanupStaleEtcdMemberCRs, that includes CRs whose etcd members no longer exist. That pass deletes this CR.

    Warning

    Do not delete the CR manually during a node removal. Re-run mkectl node remove instead.

    If a removal is in progress and the EtcdMember CR persists, trigger a reconcile. The reconciler does not run on a schedule. It runs only in the following cases:

    • An underlying etcd membership change, reflected by EtcMember object.
    • Leadership changes.
    • Its 10-second or 30-second retry timer fires.

    To trigger a reconcile, use one of the following methods:

    • Annotate the EtcdMember object:

      kubectl annotate etcdmember <node-name> mke.mirantis.com/nudge="$(date +%s)" --overwrite
      
    • Run the mkectl node remove command again. The command reasserts spec.leave on the EtcdMember object, which triggers a reconcile.

  • spec.leave is false, and the annotation is absent or its hex ID does not match status.memberID: The CR is in the VerdictOOBRemovalStaleCR state. Proceed to the repair procedure below.

What it means (VerdictOOBRemovalStaleCR). The member was removed out of band (someone ran k0s etcd leave or etcdctl member remove directly), so etcd no longer counts it, but the CR was never updated. CleanupStaleEtcdMemberCRs deletes only the verdicts in its target set — VerdictMemberLeftCRNeedsCleanup, plus VerdictLeftCRNotUpdated on the post-removal pass — and VerdictOOBRemovalStaleCR is in neither, so the object would accumulate silently.

Repair. Confirm the member really is gone from etcd, then delete the stale object:

sudo k0s etcd member-list --data-dir=<dataDir>   # the peer address must be absent
kubectl get etcdmember <node-name> -o yaml       # confirm this is the right object
kubectl delete etcdmember <node-name>

The CR is not recreated behind your back: k0s only creates it from a controller that can resolve its own member ID from its local etcd, which a removed member cannot.

If the corresponding Node still exists and the host is still running k0s, you have case §2 as well — resolve that first.