Mayur Sharma:
Regarding ETCD backup and restore, can someone please confirm do we need to update the mountPath inside the volume mount as well (if we use a different directory in case of restore)
Commands used for backup and restore ,
• Backup
ETCDCTL_API=3 etcdctl --endpoints=<https://127.0.0.1:2379> \
--cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/server.crt --key=/etc/kubernetes/pki/etcd/server.key \
snapshot save /opt/snapshot-pre-boot.db
• Restore,
ETCDCTL_API=3 etcdctl --endpoints=<https://127.0.0.1:2379> \
--cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/server.crt --key=/etc/kubernetes/pki/etcd/server.key \
--data-dir /var/lib/etcd-from-backup snapshot restore /opt/snapshot-pre-boot.db
• Updated the hostPath in volume in /etc/kubernetes/manifests/etcd.yaml file
volumes:
- hostPath:
path: /etc/kubernetes/pki/etcd
type: DirectoryOrCreate
name: etcd-certs
Do we need to update following mountPath as well in the container, ?
volumeMounts:
- mountPath: /var/lib/etcd
name: etcd-data
- mountPath: /etc/kubernetes/pki/etcd
name: etcd-certs
If not, then why is below statement mentioned in solution part of lab.
If you do change --data-dir to /var/lib/etcd-from-backup in the YAML file, make sure that the volumeMounts for etcd-data is updated as well, with the mountPath pointing to /var/lib/etcd-from-backup (THIS COMPLETE STEP IS OPTIONAL AND NEED NOT BE DONE FOR COMPLETING THE RESTORE)