Skip to content

Instantly share code, notes, and snippets.

@ericbisme
Created August 8, 2021 20:17
Show Gist options
  • Save ericbisme/8bb09be3537d669d6ef34e784c90ad22 to your computer and use it in GitHub Desktop.
Save ericbisme/8bb09be3537d669d6ef34e784c90ad22 to your computer and use it in GitHub Desktop.
k3s/k3os Remove Master Node from embedded ETCD
https://github.com/k3s-io/k3s/issues/2732#issuecomment-749181797
Run pod with etcdctl:
kubectl run --rm --tty --stdin --image docker.io/bitnami/etcd:latest etcdctl --overrides='{"apiVersion":"v1","kind":"Pod","spec":{"hostNetwork":true,"restartPolicy":"Never","securityContext":{"runAsUser":0,"runAsGroup":0},"containers":[{"command":["/bin/bash"],"image":"docker.io/bitnami/etcd:latest","name":"etcdctl","stdin":true,"stdinOnce":true,"tty":true,"volumeMounts":[{"mountPath":"/var/lib/rancher","name":"var-lib-rancher"}]}],"volumes":[{"name":"var-lib-rancher","hostPath":{"path":"/var/lib/rancher","type":"Directory"}}]}}'
Remove member (must use hex ID):
./bin/etcdctl --key /var/lib/rancher/k3s/server/tls/etcd/client.key --cert /var/lib/rancher/k3s/server/tls/etcd/client.crt --cacert /var/lib/rancher/k3s/server/tls/etcd/server-ca.crt member remove 327051268c526155
List Members:
./bin/etcdctl --key /var/lib/rancher/k3s/server/tls/etcd/client.key --cert /var/lib/rancher/k3s/server/tls/etcd/client.crt --cacert /var/lib/rancher/k3s/server/tls/etcd/server-ca.crt member list
@evanreichard
Copy link

Appreciate it. This popped up on a Google search and helped me restore one of my clusters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment