Working with Volume Snapshots
1. Installing VolumeSnapshot CRDs
kubectl apply -k https://github.com/kubernetes-csi/external-snapshotter/client/config/crd
kubectl apply -k https://github.com/kubernetes-csi/external-snapshotter/deploy/kubernetes/snapshot-controller
| CRD | Purpose |
| VolumeSnapshotClass | Defines snapshotter parameters |
| VolumeSnapshot | User request for snapshot |
| VolumeSnapshotContent | Cluster-scoped backing snapshot |
2. Creating VolumeSnapshotClass
apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshotClass
metadata: { name: ebs-snap }
driver: ebs.csi.aws.com
deletionPolicy: Delete
parameters:
tagSpecification_1: "Backup=k8s"
3. Creating VolumeSnapshot
apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshot
metadata: { name: data-snap-2026-05 }
spec:
volumeSnapshotClassName: ebs-snap
source:
persistentVolumeClaimName: data
| Source | Field |
| PVC | persistentVolumeClaimName |
| Pre-existing | volumeSnapshotContentName |
4. Listing VolumeSnapshots
kubectl get volumesnapshot
kubectl get vsc # cluster contents
| Status | Meaning |
| ReadyToUse | true when snapshot complete |
| RestoreSize | Min PVC size for restore |
5. Describing VolumeSnapshot Details
| Field | Info |
| Source PVC | Origin |
| CreationTime | Snapshot creation |
| Bound Content | VolumeSnapshotContent name |
6. Restoring PVC from Snapshot
apiVersion: v1
kind: PersistentVolumeClaim
metadata: { name: data-restore }
spec:
storageClassName: gp3
dataSource:
name: data-snap-2026-05
kind: VolumeSnapshot
apiGroup: snapshot.storage.k8s.io
accessModes: [ReadWriteOnce]
resources: { requests: { storage: 50Gi } }
7. Configuring Snapshot Deletion Policy
| deletionPolicy | Effect |
| Delete | Snapshot in backend also removed |
| Retain | Snapshot stays in backend (manual cleanup) |
8. Using Snapshot with CSI Drivers
| Driver | Notes |
| EBS CSI | EBS snapshots; cross-AZ restore supported |
| GCE PD CSI | Regional/zonal snapshots |
| Azure Disk CSI | Snapshot to same region |
| Ceph RBD | Native RBD snapshots |
9. Deleting VolumeSnapshots
kubectl delete volumesnapshot data-snap-2026-05
10. Troubleshooting Snapshot Issues
| Symptom | Cause |
| ReadyToUse=false | Driver still creating snapshot |
| Cannot restore PVC | Size mismatch; check restoreSize |
| Stuck deletion | Finalizer blocked by backend error |
| Snapshotter pod crash | Check controller logs in kube-system |