You are looking at the documentation of a prior release. To read the documentation of the latest release, please
visit here.
VolumeSnapshot Using KubeStash
This guide will give you an overview of how VolumeSnapshot process works in KubeStash.
How Backup Process Works?
The following diagram shows how KubeStash creates VolumeSnapshot via Kubernetes native API. Open the image in a new tab to see the enlarged version.
The VolumeSnapshot process consists of the following steps:
At first, a user creates a
Secretwith access credentials of the backend where the backed-up data will be stored.Then, she creates a
BackupStoragecustom resource that specifies the backend information, along with theSecretcontaining the credentials needed to access the backend.KubeStash operator watches for
BackupStoragecustom resources. When it finds aBackupStorageobject, it initializes theBackupStorageby uploading themetadata.yamlfile to the target storage.Then, she creates a
BackupConfigurationcustom resource that specifies the targeted workload/PVC, the Addon info with a specified task, etc. It also provides information about one or more repositories, each indicating a path and aBackupStoragefor storing the metadata.KubeStash operator watches for
BackupConfigurationcustom resources.Once the KubeStash operator finds a
BackupConfigurationobject, it createsRepositorywith the information specified in the BackupConfiguration.KubeStash operator watches for
Repositorycustom resources. When it finds theRepositoryobject, it InitializesRepositoryby uploadingrepository.yamlfile to thespec.sessions[*].repositories[*].directorypath specified in theBackupConfiguration.Then, it creates a
CronJobwith the schedule specified inBackupConfigurationto trigger backup periodically.On the next scheduled slot, the
CronJobtriggers a backup by creating aBackupSessioncustom resource.KubeStash operator watches for
BackupSessioncustom resources.When it finds a
BackupSessionobject, it creates aSnapshotcustom resource for eachRepositoryspecified in the respective session of theBackupConfiguration.Then, it resolves the respective
AddonandFunctionand prepares a volume snapshotterJobdefinition.Then, It creates a volume snapshotter
Jobto capture snapshots of the targeted volumes.The volume snapshotter
Jobcreates aVolumeSnapshotobject for each Persistent Volume Claim (PVC) associated the target and waits for the Container Storage Interface (CSI) driver to complete snapshotting. The VolumeSnapshot(s) are created with the following naming format:<PVC name>-<BackupSession creation timestamp in Unix epoch seconds>Container Storage Interface (CSI)
external-snapshottercontroller watches forVolumeSnapshotresources.When it finds a
VolumeSnapshotobject, it backupsVolumeSnapshotto the respective cloud storage.After the snapshotting process is completed, the volume snapshotter
Jobupdates thestatus.components[*]field of theSnapshotresources withVolumeSnapshotinformation.
How Restore Process Works?
The following diagram shows how KubeStash restores PersistentVolumeClaims from snapshot using Kubernetes VolumeSnapshot API. Open the image in a new tab to see the enlarged version.
The restore process consists of the following steps:
At first, a user creates a
RestoreSessioncustom resource that specifies thevolumeClaimTemplates, Addon info with a specified task, and aDataSourcethat determines theSnapshotfrom which the data will be restored.KubeStash operator watches for
RestoreSessioncustom resources.Once it finds a
RestoreSessionobject, it resolves the respectiveAddonandFunctionand prepares a restore Job definition.Then, it creates a Restore
Jobto restorePVCfrom thevolumeSnapshot.The restore job retrieves
VolumeSnapshotinformation from the Snapshot. Then it creates PVCs based on thevolumeClaimTemplateswithspec.dataSourceReffield set to the respectiveVolumeSnapshotname.Container Storage Interface (CSI)
external-snapshottercontroller watches forPVCs.When it finds a new
PVCwithspec.dataSourcefield set, it reads the information about theVolumeSnapshot.The controller downloads the respective data from the cloud and populates the
PVC.Finally, when the restore process is completed, the restore
Jobupdates thestatus.components[*]field of theRestoreSessionwith restore information of the target application components.






