Created
July 16, 2019 17:52
-
-
Save okgolove/4771b66e4d4900c58cd37a60b4b13dfe to your computer and use it in GitHub Desktop.
etcd2 backup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ETCD_POD=etcd-server-ip-10-0-3-241.eu-west-1.compute.internal | |
| BACKUP_NAME=etcd_backup_$(date +%s).tgz | |
| ETCD_DATA_DIR=/var/etcd/data # or /var/etcd/data-events | |
| kubectl exec -t $ETCD_POD -n kube-system -- sh -c "rm -rf /backup && etcdctl backup --data-dir=${ETCD_DATA_DIR} --backup-dir=/backup && tar -czf ${BACKUP_NAME} /backup" | |
| kubectl cp kube-system/$ETCD_POD:/${BACKUP_NAME} ${ETCD_POD}_${BACKUP_NAME} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment