Regarding ETCD backup and restore, can someone please confirm do we need to upda . . .

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)

Hinodeya:
If you use different directory just add this on you restore command --data-dir

Mayur Sharma:
@Hinodeya Right, I understand to update the volume in etcd.yaml , but why the solution asked us to update the mountPath?

Hinodeya:
you don’t need to update mountPath except if you changer the certificate location

Nitin:
You need to change only this

volumes:
  - hostPath:
      path: /var/lib/etcd-from-backup
      type: DirectoryOrCreate
    name: etcd-data