Kubernetes Volume Snapshot and Restore

Kubernetes Volume Snapshot and Restore A workflow diagram generated by Archify. 01 / Snapshot creation 02 / Restore Source PVC · PV → EBS · Snapshot creation Source PVC PV → EBS VolumeSnapshot · Class lookup · Snapshot creation VolumeSnapshot Class lookup SnapshotContent · CSI delegate · Snapshot creation SnapshotContent CSI delegate EBS snapshot · Incremental · Snapshot creation EBS snapshot Incremental Restore PVC · dataSource · Restore Restore PVC dataSource New PV bound · Restore done · Restore New PV bound Restore done 1 request 2 bind 3 create 4 dataSource 5 provision Legend Snapshot objects Claims AWS snapshot

Snapshot object model

  • • The VolumeSnapshotClass decides which CSI driver takes the snapshot
  • • VolumeSnapshot is the user request; VolumeSnapshotContent points at the real snapshot
  • • EBS snapshots are incremental, so later snapshots store only changed blocks

Restore procedure

  • • Name the VolumeSnapshot and its kind in the new PVC's spec.dataSource
  • • The restored volume must be the same size as the original or larger
  • • A restored PV inherits the region and AZ constraints of the snapshot

Operational automation

  • • Velero manages snapshot schedules and restore jobs declaratively
  • • Include PVC snapshots in namespace-level backups
  • • Rehearse restores regularly to confirm recovery actually works