Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Exam CKA topic 1 question 4 discussion

Actual exam question from CNCF's CKA
Question #: 4
Topic #: 1
[All CKA Questions]

SIMULATION -


Task -
First, create a snapshot of the existing etcd instance running at https://127.0.0.1:2379, saving the snapshot to /var/lib/backup/etcd-snapshot.db.


Next, restore an existing, previous snapshot located at /var/lib/backup/etcd-snapshot-previous.db.

Show Suggested Answer Hide Answer
Suggested Answer: See explanation below.

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
schlagzeuger1
Highly Voted 4 months ago
The solution does not fully solve the excercise, because the restore operation creates a default.etcd directory in the current directory where the utility ectdctl is called. Inside the newly created defaultl.etcd directory, it's a subdirectory called "member" containing the actual backup. That location is for sure not the one that is configured at etcd start. First is advisable to find out where the ETCD data is (--data-dir flag at service start). To effectively apply the backup, for instance, after stopping the service, we should move the targeted "member" folder in --data-dir location, let's name it $DATA_DIR_PATH, and decorate the restore operation with the flag data-dir set to $DATA_DIR_PATH: # #-- SERVICE ETCD STOPPED -- ... # mv $DATA_DIR_PATH/member $SOME_OTHER_LOCATION # ETCDCTL_API=3 etcdctl --data-dir $DATA_DIR_PATH snapshot restore /var/lib/backup/etcd-snapshot-previous.db # #-- SERVICE ETCD STARTED --
upvoted 7 times
flapa83
2 months, 2 weeks ago
This is only possible if ETCD is created as a systemd service and not as a pod. in most cases etcd will be created as a static pod, you cant utilize systemd service for that and you obviously cant have DATA_DIR_PATH as an environmental variable
upvoted 1 times
flapa83
2 months, 2 weeks ago
setting DATA_DIR_PATH is ok, not an issue, ignore initial comment on env
upvoted 1 times
...
...
asorin
3 months, 3 weeks ago
indeed, or you can repoint in the manifest file of etcd the data-dir to the restored directory
upvoted 4 times
...
...
Nicky88
Most Recent 6 days, 11 hours ago
You may have 2 etcd instances. One running in the cluster itself and the second one running outside the kubernetes cluster. They are not asking you to change context so DO NOT restore in the kubernets cluster. Follow these steps outside the cluster: 1.Execute “member list” and “snapshot status” to check hash 2.systemctl stop etcd 3.restore another backup using same certs, endpoint, and different dir 4.chown -R etcd:etcd /DIR_YOU_RESTORE 5.change dir in the service file 6.system daemon-reload 7.systermctl start etcd 8.systemctl status etcd 9.member list - to check you have different hash
upvoted 1 times
...
Nicky88
6 days, 20 hours ago
Any update about this task? Is there any step-by-step guide?
upvoted 2 times
...
pnrcka
2 weeks ago
also, after restore, the pv created in the previous question was no longer available because both the questions were to be resolved in the same context
upvoted 1 times
...
pnrcka
2 weeks ago
after restore, I couldnt find any pods,nodes on the cluster. Is this expected? does this mean that the 2nd snapshot didnt have any data?
upvoted 1 times
...
rajusai
1 month, 3 weeks ago
In the real exam you need restore from /var/lib/backup/etcd-snapshot-previous.db and there will be a permission issue, to fix this you need to be a root user and change owner permission then you need to restore db backup
upvoted 3 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...