You are looking at the documentation of a prior release. To read the documentation of the latest release, please
visit here.
How Stash Backups Kubernetes Resources
Stash v2022.05.18
supports taking backup of Kubernetes resource YAMLs. You can backup the YAML definition of the resources of entire cluster, a particular namespaces, or only an application etc. In this guide, we are going to show you how Kubernetes resource backup works in Stash.
How Backup Works
The following diagram shows how Stash takes backup of the Kubernetes resources. 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 with access credentials of the backend where the backed up data will be stored.
Then, she creates a
Repository
crd that specifies the backend information along with the secret that holds the credentials to access the backend.Then, she creates a
BackupConfiguration
crd which specifies theTask
to use to backup the the resources.Stash operator watches for
BackupConfiguration
crd.Once Stash operator finds a
BackupConfiguration
crd, it creates a CronJob with the schedule specified inBackupConfiguration
object to trigger backup periodically.On the next scheduled slot, the CronJob triggers a backup by creating a
BackupSession
crd.Stash operator also watches for
BackupSession
crd.When it finds a
BackupSession
object, it resolves the respectiveTask
andFunction
and prepares a Job definition to backup.Then, it creates the Job to backup the desired resource YAMLs.
Then, the Job dumps the Kubernetes Resource YAML, and store them temporarily in a directory.Then, it upload the content of the directory to the cloud backend.
Finally, when the backup is complete, the Job sends Prometheus metrics to the Pushgateway running inside Stash operator pod. It also updates the
BackupSession
andRepository
status to reflect the backup procedure.