etcd is a static pod running on master which store full information about the k8s cluster. It is very important to keep it safe and take backup all the time before any migration or plan

app-get install etcd-client
above is required to take backup of etcd
using this package it will give us the command etcdctl to take snapshot of etcd
ETCDCTL_API=3 etcdctl --endpoints=https://127.0.0.1:2379 –
cacert=/opt/pki/ca/crt --cert=/opt/pki/client/etcd-client.crt –key=/opt/pki/etcd-client.key
snapshot save /tmp/etcd-snapshot.db
above input details will get from the etcd yaml file
to verify the snapshot use below command

Command to restore the snapshot
ETCDCTL_API=3 etcdctl –data-dir /opt/etcd snapshot restore /tmp/etcd-snapshot.db –endpoint=https://127.0.0.1:2379


ETCDCTL_API=3 etcdctl --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/server.crt --key=/etc/kubernetes/pki/etcd/server.key --endpoints=https://101.53.148.183:2379 snapshot save /tmp/snapshot-pre-boot.db
ETCDCTL_API=3 etcdctl --endpoints=https://101.53.148.183:2379 snapshot restore /tmp/snapshot-pre-boot.db