You are looking at the documentation of a prior release. To read the documentation of the latest release, please
visit here.
Backup and Restore Workloads using Stash
This guide will show you how Stash backs up and restores volumes of various workload types (Deployment, StatefulSet, DaemonSet etc.).
Before You Begin
- You should be familiar with the following
Stashconcepts:
How Backup Process Works
The following diagram shows how Stash takes backup of the volumes of a workload. Open the image in a new tab to see the enlarged version.
The backup process consists of the following steps:
At first, a user creates a Secret. This secret holds the credentials to access the backend where the backed up data will be stored.
Then, she creates a
Repositorycrd which represents the original repository in the backend.Then, she creates a
BackupConfigurationcrd which specifies the targeted workload and desired file paths to backup. It also specifies theRepositoryobject that holds the backend information where the backed up data will be stored.Stash operator watches for
BackupConfigurationobjects.When it finds a
BackupConfigurationobject, it finds the targeted workload and injects a sidecar namedstash.It also creates a
CronJobto trigger backups periodically.The
CronJobtriggers backup on each scheduled slot by creating aBackupSessioncrd.The
stashsidecar inside the workload watches forBackupSessioncrd.When it finds a
BackupSessioncrd, it initiates backup of the targeted file paths.Once the backup process is completed, the
sidecarsends Prometheus metrics to the Pushgateway running inside thestash-operatorpod. It also updates respectiveBackupSessionandRepositorystatus to reflect the backup process.
How Restore Process Works
The following diagram shows how Stash restores backed up data inside a workload. Open the image in a new tab to see the enlarged version.
The restore process consists of the following steps:
At first, the user creates a workload where the data will be restored.
Then, she creates a
RestoreSessioncrd that specifies the targeted workload where the backed up data will be restored. It also specifies the respectiveRepositorythat holds the respective backend information.Stash operator watches for
RestoreSessioncrds.When it finds a
RestoreSessioncrd, it injects an init-container namedstash-initto the workload and restart it.The init-container restores the desired data from the backend on start-up.
Finally, when the restore process is completed it sends Prometheus metrics to the
pushgatewayrunning inside the stash operator. It also update theRestoreSessionstatus to reflect the restore process.
Note: If your workload restarts with the
stash-initinit-container for any reason, the init-container will skip running restore process if there is no pendingRestoreSessionfor this workload.






