Volume Snapshot Classes

    Just like StorageClass provides a way for administrators to describe the “classes” of storage they offer when provisioning a volume, VolumeSnapshotClass provides a way to describe the “classes” of storage when provisioning a volume snapshot.

    Each VolumeSnapshotClass contains the fields , deletionPolicy, and parameters, which are used when a VolumeSnapshot belonging to the class needs to be dynamically provisioned.

    Note: Installation of the CRDs is the responsibility of the Kubernetes distribution. Without the required CRDs present, the creation of a VolumeSnapshotClass fails.

    Administrators can specify a default VolumeSnapshotClass for VolumeSnapshots that don’t request any particular class to bind to by adding the snapshot.storage.kubernetes.io/is-default-class: "true" annotation:

    1. apiVersion: snapshot.storage.k8s.io/v1
    2. kind: VolumeSnapshotClass
    3. name: csi-hostpath-snapclass
    4. snapshot.storage.kubernetes.io/is-default-class: "true"
    5. driver: hostpath.csi.k8s.io
    6. deletionPolicy: Delete

    DeletionPolicy

    Volume snapshot classes have a deletionPolicy. It enables you to configure what happens to a VolumeSnapshotContent when the VolumeSnapshot object it is bound to is to be deleted. The deletionPolicy of a volume snapshot class can either be Retain or Delete. This field must be specified.

    If the deletionPolicy is Delete, then the underlying storage snapshot will be deleted along with the VolumeSnapshotContent object. If the deletionPolicy is Retain, then both the underlying snapshot and VolumeSnapshotContent remain.