Hi,
I am currently trying to complete q3 of a kubernetes mock exam, but I am unable to. I really do need to practice this topic as this is one of the questions know I had issues with in the real exam. As you can see I have already ssh’d into the node and tried to restore based on the kubernetes.io documentation. I know this isn’t meant to be that hard. I do know that in the solution you provide you request we install the etcd utility using the following commands which I have done. However this is not practical in the exam as we would need to go to github to get the correct html address. None of this is in the documentation on kubernetes website. So I do not think it is practical to request us to memorise something that a) isn’t in the exam and b) does not make the snapshot restore command work.
install the etcd utility :
cluster1-controlplane ~ ➜ cd /tmp
cluster1-controlplane ~ ➜ export RELEASE=$(curl -s https://api.github.com/repos/etcd-io/etcd/releases/latest | grep tag_name | cut -d '"' -f 4)
cluster1-controlplane ~ ➜ wget https://github.com/etcd-io/etcd/releases/download/${RELEASE}/etcd-${RELEASE}-linux-amd64.tar.gz
cluster1-controlplane ~ ➜ tar xvf etcd-${RELEASE}-linux-amd64.tar.gz ; cd etcd-${RELEASE}-linux-amd64
cluster1-controlplane ~ ➜ mv etcd etcdctl /usr/local/bin/
cluster1-controlplane ~ ➜ etcdctl snapshot restore --data-dir /root/default.etcd /opt/cluster1_backup_to_restore.db
cluster1-controlplane ~ ➜ ETCDCTL_API=3 etcdctl --data-dir /root/default.etcd snapshot restore /opt/cluster1_backup_to_restore.db
Deprecated: Use etcdutl snapshot restore
instead.
2024-04-15T01:41:14Z info snapshot/v3_snapshot.go:260 restoring snapshot {“path”: “/opt/cluster1_backup_to_restore.db”, “wal-dir”: “/root/default.etcd/member/wal”, “data-dir”: “/root/default.etcd”, “snap-dir”: “/root/default.etcd/member/snap”}
2024-04-15T01:41:14Z info membership/store.go:141 Trimming membership information from the backend…
2024-04-15T01:41:14Z info membership/cluster.go:421 added member {“cluster-id”: “cdf818194e3a8c32”, “local-member-id”: “0”, “added-peer-id”: “8e9e05c52164694d”, “added-peer-peer-urls”: [“http://localhost:2380”]}
2024-04-15T01:41:14Z info snapshot/v3_snapshot.go:287 restored snapshot {“path”: “/opt/cluster1_backup_to_restore.db”, “wal-dir”: “/root/default.etcd/member/wal”, “data-dir”: “/root/default.etcd”, “snap-dir”: “/root/default.etcd/member/snap”}
If I am wrong, please tell me, but your solution which I copied after failing this question a dozen times does not work. Please either fix the lab or fix the solution.