Stand-alone Volume Backup Overview
This guide will give you an overview of how stand-alone volume backup and restore process works in KubeStash.
How Backup Works
The following diagram shows how KubeStash takes backup of a stand-alone volume. 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
BackupStorage
custom resource that specifies the backend information, along with theSecret
containing the credentials needed to access the backend.KubeStash operator watches for
BackupStorage
custom resources. When it finds aBackupStorage
object, it initializes theBackupStorage
by uploading themetadata.yaml
file to the target storage.Then, she creates a
BackupConfiguration
custom resource, targeting a standalone volume. TheBackupConfiguration
object specifies theRepository
pointing to aBackupStorage
that contains backend information, indicating where to upload backup data. It also defines theAddon
information with a specified task and their configuration parameters to be used for backing up the volumes.KubeStash operator watches for
BackupConfiguration
custom resources.Once the KubeStash operator finds a
BackupConfiguration
object, it createsRepository
with the information specified in the BackupConfiguration.KubeStash operator watches for
Repository
custom resources. When it finds theRepository
object, it InitializesRepository
by uploadingrepository.yaml
file to thespec.sessions[*].repositories[*].directory
path specified in theBackupConfiguration
.Then, it creates a
CronJob
for each session with the schedule specified inBackupConfiguration
to trigger backup periodically.On the next scheduled slot, the
CronJob
triggers a backup by creating aBackupSession
custom resource.KubeStash operator watches for
BackupSession
custom resources.When it finds a
BackupSession
object, it creates aSnapshot
custom resource for eachRepository
specified in the respective session of theBackupConfiguration
.Then, it resolves the respective
Addon
andFunction
and prepares a backupJob
definition.Then, it mounts the targeted stand-alone volume into the
Job
and creates it.The
Job
takes backup of the targeted stand-alone volume.After the backup process is completed, the backup
Job
(s) updates thestatus.components[*]
field of theSnapshot
resources with backup information of the target volume.
How Restore Works
The following diagram shows how KubeStash restores backed up data into a stand-alone volume. 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 stand-alone volume where the data will be restored or the user can use the same stand-alone volume.
Then, she creates a
RestoreSession
custom resource, specifies the target stand-alone volume where the backed-up data will be restored, theRepository
object that points to aBackupStorage
that holds backend information, and the targetSnapshot
, which will be restored. It also specifies theAddon
info with task to use to restore the volume.KubeStash operator watches for
RestoreSession
custom resources.Once it finds a
RestoreSession
object, it resolves the respectiveAddon
andFunction
and prepares a restore Job definition.Then, it mounts the targeted volume and creates a Restore
Job
.The restore
Job
restores the backed-up data into the targeted volume.Finally, when the restore process is completed, the restore
Job
updates thestatus.components[*]
field of theRestoreSession
with restore information of the target volume.
Next Steps
- Learn how to take backup and restore a stand-alone PVC from here.