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

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

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:

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
rajusai
Highly Voted 1 year, 3 months 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 13 times
MYOM
6 months, 2 weeks ago
take note ppl!
upvoted 2 times
...
rakeshsjadhav
9 months, 3 weeks ago
Cd /etc/Kubernetes/manifest---- to check etcd yaml . Any scenario where this manifest file was not located ?
upvoted 1 times
BOD007
7 months, 2 weeks ago
If its an external etcd-server you will not see the manifest.
upvoted 1 times
BOD007
7 months, 2 weeks ago
If etcd is stacked, meaning it is running as a pod on the master node... the manifest file should be there. I strongly doubt the exam will setup an external etcd server as it will take a lot more effort to complete that task. Personally, i will start by checking ; - If there is an etcd pod on the master-node - Describe the api-server pod to see the etcd-server address(localhost or remote) - If local, then business as usual - If remote you will need some additional steps to fully restore, including ssh into the etcd server and modifying the --data-dir at systemd/system/etcd.service file ( A lot more headache)
upvoted 2 times
...
...
...
...
schlagzeuger1
Highly Voted 1 year, 5 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 12 times
flapa83
1 year, 3 months 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 2 times
flapa83
1 year, 3 months ago
setting DATA_DIR_PATH is ok, not an issue, ignore initial comment on env
upvoted 1 times
...
...
asorin
1 year, 5 months ago
indeed, or you can repoint in the manifest file of etcd the data-dir to the restored directory
upvoted 8 times
...
...
Vish0211
Most Recent 3 weeks, 1 day ago
Do we need to update the Volume.hostPath in file - /etc/kubernetes/manifests/etcd.yaml post restore ?
upvoted 1 times
...
deepu_dhanu123
3 weeks, 1 day ago
does any one have full questions
upvoted 1 times
...
abilalzengin
2 months, 2 weeks ago
Solution is here > https://www.youtube.com/watch?v=Onb85cQl1jc
upvoted 3 times
...
Ayxanus0610
2 months, 2 weeks ago
$ ETCDCTL_API=3 etcdctl --endpoints 127.0.0.1:2379 --cacert=/opt/KUIN00601/ca.crt --cert=/opt/KUIN00601/etcd-client.crt --key=/opt/KUIN00601/etcd-client.key snapshot save /var/lib/backup/etcd-snapshot.db $ ETCDCTL_API=3 etcdctl --endpoints 127.0.0.1:2379 --cacert=/opt/KUIN00601/ca.crt --cert=/opt/KUIN00601/etcd-client.crt --key=/opt/KUIN00601/etcd-client.key snapshot restore /var/lib/backup/etcd-snapshot-previous.db This is more effective one you can use
upvoted 2 times
...
seifezzeldin95
3 months, 1 week ago
Are these questions really in the real exam or they are similar only?
upvoted 1 times
Newbie_devops
1 month, 1 week ago
Yes, I have had this one on the exam last week :)
upvoted 1 times
Karun3294
3 weeks, 5 days ago
Hii did you need to check permission or did you get any difficulty while restoring it
upvoted 1 times
...
...
...
LavaPup
6 months, 2 weeks ago
Wondering if no one has noticed the path in question? It clearly says to take the snapshot under /var/lib/backup/ but it seems everyone is okay with /etc/data/ Any hints/help?
upvoted 4 times
...
DSK
6 months, 3 weeks ago
Why do we need to stop etcd service?
upvoted 1 times
Portman
6 months, 3 weeks ago
I guess that it is always a good practice, so that you make sure nothing is writing on ETCD while performing the restore.
upvoted 1 times
...
...
Anky1090
7 months, 4 weeks ago
If you see that the question simply says to restore a backup. Doesn't mention any data directory. There's a default.etcd directory that gets created if you restore this in the current working directory in the exam. Remember, if the etcd doesn't come back up the way it's expected, you may loose onto resources in the K8s cluster. There are around 9-10 questions to be performed in that context. You need to treat this question very carefully and not mess with the database by changing the manifest file.
upvoted 5 times
...
mellohello
11 months ago
#backup ETCDCTL_API=3 etcdctl --endpoints="https://127.0.0.1:2379" --cacert=/opt/KUIN000601/ca.crt --cert=/opt/KUIN000601/etcd-client.crt --key=/opt/KUIN000601/etcd-client.key snapshot save /etc/data/etcd-snapshot.db #restore ETCDCTL_API=3 etcdctl --endpoints="https://127.0.0.1:2379" --cacert=/opt/KUIN000601/ca.crt --cert=/opt/KUIN000601/etcd-client.crt --key=/opt/KUIN000601/etcd-client.key snapshot restore /var/lib/backup/etcd-snapshot-previoys.db
upvoted 8 times
...
mrallrounder123453656
11 months, 2 weeks ago
do we need to run these backup/restored commands from the master node?
upvoted 1 times
...
sTeVe86
1 year ago
https://kubernetes.io/docs/tasks/administer-cluster/configure-upgrade-etcd/ to cover the etcd backup and restore
upvoted 1 times
...
Nicky88
1 year, 1 month 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 6 times
...
Nicky88
1 year, 1 month ago
Any update about this task? Is there any step-by-step guide?
upvoted 2 times
...
pnrcka
1 year, 1 month 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
leebug
10 months, 3 weeks ago
you could refer to the Certified Kubernetes Administrator (CKA) with Practice Tests "Practice Test Backup and Restore Methods 2" session by Mumshad Mannambeth
upvoted 1 times
...
...
pnrcka
1 year, 1 month 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 3 times
didorins
10 months ago
Same. I suspected permission issues, but when I compared /var/lib/etcd (default datadir) with the one I used for back-up, there was no permission diff (same owner etc)
upvoted 1 times
spocknimoy
10 months ago
Same with me, a thin that I lost my role exam yesterday
upvoted 1 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 ...