Automated daily etcd-backup on OCP 4

Latest response

So I followed https://docs.openshift.com/container-platform/4.3/backup_and_restore/backing-up-etcd.html and created a script for automating the etcd-backup.

First I created a ssh key pair for a user on a "management host" and then I added the public key to 99-master-ssh machineconfig.

This scripts is executed as the user from a cronjob daily:

cd /var/backup/openshift
ssh core@etcd-0.mydomain.com "sudo /usr/local/bin/etcd-snapshot-backup.sh ./assets/backup/snapshot.db" | exit 1
scp -r core@etcd-0.mydomain.com:./assets/backup/snapshot.db ./ | exit 2
mv snapshot.db snapshot-$(date +%Y-%m-%d).db

The "management host" is then backed up by the central backup software.

Any other/better suggestions how to do this?

Responses