Install the Velero server in the CSAH node that is running Red Hat Enterprise Linux 7.9. Follow these steps:
[core@csah velero]$ wget https://github.com/vmware-tanzu/velero/releases/download/v1.5.2/velero-v1.5.2-linux-amd64.tar.gz
[root@csah ~]# tar -czvf /home/core/velero/velero-v1.5.2-linux-amd64.tar.gz
[root@csah ~]# cd velero-v1.5.2-linux-amd64
[root@csah velero-v1.5.2-linux-amd64]# pwd
/home/core/velero/velero-v1.5.2-linux-amd64
[root@csah velero-v1.5.2-linux-amd64]# cp velero /usr/bin/
[core@csah velero]$ wget https://dl.min.io/server/minio/release/linux-amd64/minio
export MINIO_ACCESS_KEY=minio
export MINIO_SECRET_KEY=minio123
[core@csah minio]$ ./minio server bucket &
[1] 272822
[core@csah minio]$ Attempting encryption of all config, IAM users and policies on MinIO backend
Endpoint: http://192.168.46.20:9000 http://192.168.122.1:9000 http://127.0.0.1:9000
AccessKey: minio
SecretKey: minio123
Browser Access:
http://192.168.46.20:9000 http://192.168.122.1:9000 http://127.0.0.1:9000
Command-line Access: https://docs.min.io/docs/minio-client-quickstart-guide
$ mc alias set myminio http://192.168.46.20:9000 minio minio123
Object API (Amazon S3 compatible):
Go: https://docs.min.io/docs/golang-client-quickstart-guide
Java: https://docs.min.io/docs/java-client-quickstart-guide
Python: https://docs.min.io/docs/python-client-quickstart-guide
JavaScript: https://docs.min.io/docs/javascript-client-quickstart-guide
.NET: https://docs.min.io/docs/dotnet-client-quickstart-guide
[core@csah minio]$ wget https://dl.min.io/client/mc/release/linux-amd64/mc
[root@csah ~]# firewall-cmd --permanent --add-port=9000/tcp
success
[root@csah ~]# firewall-cmd --reload
Success
[core@csah minio]$ ./mc config host add velero http://192.168.46.20:9000 $MINIO_ACCESS_KEY $MINIO_SECRET_KEY
mc: Configuration written to `/home/core/.mc/config.json`. Please update your access credentials.
mc: Successfully created `/home/core/.mc/share`.
mc: Initialized share uploads `/home/core/.mc/share/uploads.json` file.
mc: Initialized share downloads `/home/core/.mc/share/downloads.json` file.
Added `velero` successfully.
[core@csah minio]$ ./mc mb -p velero/velero
Bucket created successfully `velero/velero`.
[core@csah minio]$ cat credentials-velero
[default]
aws_access_key_id = minio
aws_secret_access_key = minio123
velero install \
--features=EnableCSI \
--provider aws \
--plugins velero/velero-plugin-for-aws:v1.0.0,velero/velero-plugin-for-csi:v0.1.0 \
--bucket velero \
--secret-file ./credentials-velero \
--use-volume-snapshots=true \
--backup-location-config region=minio,s3ForcePathStyle="true",s3Url=http://192.168.46.20:9000 \
--snapshot-location-config region="default"
[core@csah minio]$ oc get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
velero-f65d7d8cb-h8826 1/1 Running 0 40s 10.131.1.193 compute-2.example.com <none> <none>
Follow these steps:
[core@csah velero]$ oc new-project test-velero
[core@csah velero]$ oc create -f <YAML file>
[core@csah velero-v1.5.2-linux-amd64]$ oc exec -it velero-bkpone-pod /bin/bash
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] -- [COMMAND] instead.
root@velero-bkpone-pod:/# cd /usr/share/nginx/html/
root@velero-bkpone-pod:/usr/share/nginx/html# touch sample
root@velero-bkpone-pod:/usr/share/nginx/html# echo 'before backup' > sample
[core@csah velero]$ velero backup create csi-velero-backup --include-namespaces test-velero
Backup request "csi-velero-backup" submitted successfully.
Run `velero backup describe csi-velero-backup` or `velero backup logs csi-velero-backup` for more details.
[core@csah velero-v1.5.2-linux-amd64]$ velero get backup
NAME STATUS ERRORS WARNINGS CREATED EXPIRES STORAGE LOCATION SELECTOR
csi-velero-backup Completed 0 1 2020-12-26 20:24:13 -0500 EST 29d default <none>
A snapshot is created when there is a PVC in the namespace that is backed up in the preceding step:
[core@csah velero]$ oc get volumesnapshot
NAME READYTOUSE SOURCEPVC SOURCESNAPSHOTCONTENT RESTORESIZE SNAPSHOTCLASS SNAPSHOTCONTENT CREATIONTIME AGE
velero-velero-bkpone-pvc-q7z9c true velero-bkpone-pvc 2Gi unity-snap snapcontent-f6b88526-e499-4428-9195-24fd4f40521d 2m26s 59s
[core@csah velero]$ oc get volumesnapshotcontents.snapshot.storage.k8s.io
NAME READYTOUSE RESTORESIZE DELETIONPOLICY DRIVER VOLUMESNAPSHOTCLASS VOLUMESNAPSHOT AGE
snapcontent-f6b88526-e499-4428-9195-24fd4f40521d true 2147483648 Delete csi-unity.dellemc.com unity-snap velero-velero-bkpone-pvc-q7z9c 9m16s
To restore the PVC:
[core@csah velero-v1.5.2-linux-amd64]$ oc delete -f <YAML file>
persistentvolumeclaim "velero-bkpone-pvc" deleted
[core@csah velero-v1.5.2-linux-amd64]$ oc delete -f <YAML file>
pod "velero-bkpone-pod" deleted
Note: The YAML file uses the same sample YAML files that were used to create the PVC and POD in Creating a backup:
[core@csah velero-v1.5.2-linux-amd64]$ velero create restore --from-backup csi-velero-backup
Restore request "csi-velero-backup-20201226211645" submitted successfully.
Run `velero restore describe csi-velero-backup-20201226211645` or `velero restore logs csi-velero-backup-20201226211645` for more details.
Note: csi-velero-backup is the name of the backup that is created in Step 5 in Creating a backup.
[core@csah velero-v1.5.2-linux-amd64]$ oc get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
velero-bkpone-pvc Bound csiunity-83cc00c497 2Gi RWO unity-fc 42s
[core@csah velero-v1.5.2-linux-amd64]$ oc get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
velero-bkpone-pod 1/1 Running 0 106s 10.131.0.175 compute-2.example.com <none> <none>
[core@csah velero]$ oc exec -it velero-bkpone-pod -- cat /usr/share/nginx/html/sample
before backup