TKG Service clusters support volume snapshot and restore capabilities. As a DevOps user, you can protect workloads in TKG clusters by taking volume snapshots.
You can use a snapshot to provision a new volume, pre-populated with the snapshot data.
Prerequisites
- vSphere 8.0 Update 2 or later.
- Tanzu Kubernetes release that supports CSI snapshots, which is TKr v1.26.5 or later for vSphere 8.0.2 or later. See VMware Tanzu Kubernetes releases Release Notes.
- Latest compatible Supervisor version. See VMware vSphere with Tanzu 8.0 Release Notes.
Requirements
CSI snapshot functionality is delivered as a TKG package. The requirements for using CSI snapshot package are as follows:
- Use the TKG Standard Package repository version v2023.9.19 or later. See Tanzu Standard Package Repository Versions.
- Install the cert manager package. See Installing and Using VMware Tanzu Packages.
- Install and deploy vsphere-pv-csi-webhook using the Tanzu CLI. See Install and Deploy the vSphere PVCSI Webhook.
- Install and deploy external-csi-snapshot-webhook using the Tanzu CLI. See Install and Deploy External CSI Snapshot Webhook.
Guidelines and Limitations
When you use the snapshot and restore functionality with TKG clusters, follow these guidelines.
- Only block volumes support volume snapshot and restore operations. You cannot use these operations with vSphere file volume.
- When you create a PVC from a VolumeSnapshot, it should reside on the same datastore as the original VolumeSnapshot. Otherwise, the provisioning of that PVC fails with the following error:
failed to provision volume with StorageClass <storage-class-name>: rpc error: code = Internal desc = failed to create volume. Error: failed to get the compatible datastore for create volume from snapshot <snapshot-name> with error: failed to find datastore with URL <datastore-url> from the input datastore list, <[datastore-list]>
The datastore for the target PVC that you create from the VolumeSnapshot is determined by the StorageClass in the PVC definition. Make sure that the StorageClass of the target PVC and the StorageClass of the original source PVC point to the same datastore, which is the datastore of the source PVC. This rule also applies to the topology requirements in the StorageClass definitions. The requirements must also point to the same common datastore. Any conflicting topology requirements result in the same error as shown above.
- You cannot delete or expand a volume that contains associated snapshots. Delete all snapshots to expand or delete the source volume.
- When you create a volume from a snapshot, ensure that the size of the volume matches the size of the snapshot.
- Storage Quota monitoring is not supported for snapshots.
- You cannot configure the maximum number of snapshots per volume in vSphere configuration. For a better performance, use two to three snapshots per virtual disk. For more information, see Best practices for using VMware snapshots in the vSphere environment.
For vSAN ESA, use maximum 32 snapshots per volume. For more information about vSAN ESA, see vSAN Express Storage Architecture.