HOW TO TAKE PVC BACKUP IN LINODE?
I am unable to find a way to backup pvc.
1 Reply
✓ Best Answer
Install velero + restic
Download velero binary (https://github.com/vmware-tanzu/velero/releases)
untar velero binary using
tar -zvxf filename
sudo mv velero-v1.8.1-linux-arm64/velero /usr/local/bin/
or set path to the folder which you have untar on second stepvelero help (to check if velero is installed or not)
install velero + restic to the cluster
velero install \
--provider velero.io/aws \
--bucket LINODE_BUCKET_NAME \
--plugins velero/velero-plugin-for-aws:v1.0.1\
--backup-location-config s3Url=https://us-southeast-1.linodeobjects.com,region=us-southeast-1 \
--use-volume-snapshots=true \
--secret-file=./cloud-credentials --image velero/velero:v1.4.0 --use-restic
(Dont forget to change the region in url and region paramaeter )as to take backup with restic we need to annotate pod and statefulset or deployment and dont use pvc or pv name but use disk name declared in your manifest yaml file
kubectl -n <namespace name> annotate pod/mysql-dev-0 [backup.velero.io/backup-volumes=<disk_name>](http://backup.velero.io/backup-volumes=<Disk name>)
velero backup create **BACKUP_NAME** --include-namespaces <namespace> --wait
velero restore create --from-backup **BACKUP_NAME**
IMPORTANT POINT
restic is demon set to it will run on each and every node so suppose if you have tainted some node then remove taint . and taint again
after restore kindly make sure restic init container got initiated ( this will help to restore data from s3 or object storage)
if your statefulset contain taint and toleration make sure same is already created on new cluster or same cluster ( kindly don’t edit statefulset using kubect edit)
cloud credential file containts
aws_access_key_id=<linode_access_key></linode_access_key>
aws_secret_access_key=<linode_secret_access_key></linode_secret_access_key>