You can backup and restore Tanzu Kubernetes cluster workloads using the Velero Plugin for vSphere. However, if you require portability, use standalone Velero.
To backup and restore Tanzu Kubernetes clusters workloads using the Velero Plugin for vSphere, you must first install Velero and the Velero Plugin for vSphere on the target cluster. See Install and Configure the Velero Plugin for vSphere on a Tanzu Kubernetes Cluster.
Backup a Workload
velero backup create <backup name> --include-namespaces=my-namespace
Velero backup will be marked as
Completed after all local snapshots have been taken and Kubernetes metadata, except volume snapshots, has been uploaded to the object store. At this point, asynchronous data movement tasks, i.e., the upload of volume snapshot, are still happening in the background and may take some time to complete. We can check the status of volume snapshot by monitoring Snapshot Custom Resources (CRs).
Snapshots are used for backing up persistent volumes. For each volume snapshot, a Snapshot CR is created in the same namespace as the persistent volume claim (PVC) that is snapshotted.
kubectl get -n <pvc namespace> snapshot
|New||Not processed yet|
|Snapshotted||Local snapshot was taken|
|SnapshotFailed||Local snapshot was failed|
|Uploading||The snapshot is being uploaded|
|Uploaded||The snapshot is uploaded|
|UploadFailed||The snapshot is failed to be uploaded|
|Canceling||The upload of snapshot is being cancelled|
|Canceled||The upload of snapshot is cancelled|
|CleanupAfterUploadFailed||The Cleanup of local snapshot after the upload of snapshot was failed|
Restore a Workload
velero restore create --from-backup <velero-backup-name>
Velero restore will be marked as
Completed when volume snapshots and other Kubernetes metadata have been successfully restored to the current cluster. At this point, all tasks of vSphere plugin related to this restore are completed as well. There are no any asynchronous data movement tasks behind the scene as that in the case of Velero backup.
CloneFromSnapshotCustom Resource (CR) will be created in the same namespace as the PVC that is originally snapshotted. We can get all CloneFromSnapshots in PVC namespace by running the following command.
kubectl -n <pvc namespace> get clonefromsnapshot
|New||Clone from snapshot is not completed|
|InProgress||The vSphere volume snapshot is being downloaded from remote repository|
|Completed||Clone from snapshot is completed|
|Failed||Clone from snapshot is failed|