After etcdutl snapshot restore /backup/etcd.db --data-dir /var/lib/etcd-restore, what must you do on a kubeadm control plane node so the cluster uses the restored data?
- A.
Run
kubectl apply -f /backup/etcd.dbagainst the API server. - B.
Change only the
--data-dirflag in the etcd manifest and leave theetcd-datahostPath volume unchanged. - C.
Run
kubeadm resetfollowed bykubeadm init --etcd-snapshot=/backup/etcd.db. - D.
Edit
/etc/kubernetes/manifests/etcd.yamlso theetcd-datahostPath volume points to/var/lib/etcd-restore; the kubelet then recreates the static Pod.
Show answer and explanation
Answer: D
etcd runs as a static Pod. The restored directory must be mounted into it, so change the hostPath of the data volume (and keep the container's --data-dir consistent with the mounted path). The kubelet notices the manifest change and restarts etcd.
- A snapshot is not a Kubernetes manifest.
- Only changing the flag leaves the new directory unmounted in the container.
kubeadm inithas no--etcd-snapshotoption, andresetwould wipe the node.