You can use the Velero Plugin for vSphere to backup and restore workloads running on vSphere Pods.
Overview
Prerequisites
Backup a vSphere Pod
velero backup create <backup name> --include-namespaces=my-namespace
The backup is marked Completed
after all local snapshots have been taken and Kubernetes metadata is uploaded to the object store. However, the backup of volume snapshots occurs asynchronously and may still be occurring in the background and take some time to complete.
You can check the status of volume snapshots by monitoring Snapshot and Upload custom resources.
Snapshot CRD
kubectl get -n <pvc namespace> snapshot
status.phase
field, including:
State | Description |
---|---|
New | Not processed yet |
Snapshotted | Local snapshot was taken |
SnapshotFailed | Local snapshot failed |
Uploading | Snapshot is being uploaded |
Uploaded | Snapshot is uploaded |
UploadFailed | Snapshot failed to be uploaded |
Canceling | Upload of snapshot is being cancelled |
Canceled | Upload of snapshot is cancelled |
CleanupAfterUploadFailed | Cleanup of local snapshot after the upload of snapshot failed |
Upload CRD
kubectl get -n <velero namespace> upload
status.phase
field, including:
State | Description |
---|---|
New | Not processed yet |
InProgress | Upload in progress |
UploadError | Upload failed |
CleanupFailed | Delete local snapshot failed after the upload Will be retried |
Canceling | Upload is being cancelled Can occur if |
Canceled | Upload is cancelled |
Restore a vSphere Pod
- Create a vSphere Namespace for the workload you will restore.
- Configure the storage policy for the namespace.
- Run the following Velero command to restore the workload:
velero restore create --from-backup 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 asynchronous data movement tasks behind the scene as that in the case of Velero backup.
Before Velero restore is Completed
, you can check the status of volume restore by monitoring CloneFromSnapshot/Download CRs as below.
CloneFromSnapshots CRD
kubectl -n <pvc namespace> get clonefromsnapshot
status.phase
field, including:
State | Description |
---|---|
New | Clone from snapshot is not completed |
Completed | Clone from snapshot is completed |
Failed | Clone from snapshot failed |
kubectl -n <velero namespace> get download
status.phase
field, including:
Status | Description |
---|---|
New | Not processed yet |
InProgress | Download in progress |
Completed | Download is completed |
Retry | Download is retried. When there is any failure during the download of backup data, the download is retried |
Failed | Download is failed |