Practice Test - Backup and Restore Methods
Take me to Practice Test
Solutions to practice test - Backup and Restore Methods
-
How many deployments exist in the cluster?
kubectl get deployments -
What is the version of ETCD running on the cluster?
kubectl describe pod -n kube-system etcd-controlplaneFind the entry for
Image -
At what address can you reach the ETCD cluster from the controlplane node?
kubectl describe pod -n kube-system etcd-controlplaneUnder
Commandfind--listen-client-urls -
Where is the ETCD server certificate file located?
On kubeadm clusters like this one, the default location for certificate files is
/etc/kubernetes/pki/etcdChoose the correct certificate
-
Where is the ETCD CA Certificate file located?
On kubeadm clusters like this one, the default location for certificate files is
/etc/kubernetes/pki/etcdChoose the correct certificate
-
Take a snapshot of the ETCD database using the built-in snapshot functionality.
Store the backup file at location /opt/snapshot-pre-boot.dbETCDCTL_API=3 etcdctl snapshot save \ --cacert=/etc/kubernetes/pki/etcd/ca.crt \ --cert=/etc/kubernetes/pki/etcd/server.crt \ --key=/etc/kubernetes/pki/etcd/server.key \ /opt/snapshot-pre-boot.db -
Information only.
-
Wake up! We have a conference call! After the reboot the master nodes came back online, but none of our applications are accessible. Check the status of the applications on the cluster. What's wrong?
All of the above
-
Luckily we took a backup. Restore the original state of the cluster using the backup file.
-
Restore the backup to a new directory
ETCDCTL_API=3 etcdctl snapshot restore \ --data-dir /var/lib/etcd-from-backup \ /opt/snapshot-pre-boot.db -
Modify the
etcdpod to use the new directory.To do this, we need to edit the
volumessection and change thehostPathto be the directory we restored to.vi /etc/kubernetes/manifests/etcd.yamlvolumes: - hostPath: path: /etc/kubernetes/pki/etcd type: DirectoryOrCreate name: etcd-certs - hostPath: path: /var/lib/etcd # <- change this type: DirectoryOrCreate name: etcd-dataNew value:
/var/lib/etcd-from-backupSave this and wait for up to a minute for the
etcdpod to reload. -
Verify
kubectl get deployments kubectl get services
-
See also: https://github.com/kodekloudhub/community-faq/blob/main/docs/etcd-faq.md