Note
Installation of the CRDs is the responsibility of the Kubernetes distribution. Without the required CRDs present, the creation of a VolumeSnapshotClass fails. And you also need to ensure that the required components, including the external snapshotter controller (snapshot-controller, StorageClass) are installed.
Here is an example of StorageClass.yml file for reference.
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: csi-hostpjath-sc
annotations:
storageclass.kubernetes.io/is-default-class: "false"
provisioner: hostpath.csi.k8s.io
reclaimPolicy: Retain # default value is Delete
allowVolumeExpansion: true
mountOptions:
- discard # this might enable UNMAP / TRIM at the block storage layer
volumeBindingMode: WaitForFirstConsumer
parameters:
guaranteedReadWriteLatency: "true" # provider-specific
Once the StorageClass is created, you can include storageClassName field in PersistentVolumeClaim manifest file that requests storage from the StorageClass.
Here’s an example PVC YAML manifest.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: my-pvc
spec:
accessModes:
- ReadWriteOnce
storageClassName: csi-hostpjath-sc
resources:
requests:
storage: 1Gi
An Introduction To Kubernetes Volume Snapshots
Kubernetes is an open-source container orchestration platform designed to automate the deployment, scaling, and management of containerized applications with unparalleled efficiency and flexibility to meet fluctuating demand and ensure high availability through the automated self-healing mechanism.
Kubernetes, crafted in the Go programming language and originating from Google’s internal ” Borg ” project, officially emerged as an open-source platform. later subsequent donation to the Cloud Native Computing Foundation (CNCF). Kubernetes has seen exponential growth and adoption, becoming the standard for container orchestration Tools in the Tech industry.