You are looking at the documentation of a prior release. To read the documentation of the latest release, please
visit here.
How KubeStash Backups Kubernetes Resources
KubeStash v2025.2.10 supports taking backup of Kubernetes resource YAMLs. You can backup the YAML definition of the resources of entire cluster, a particular namespace, or only an application. In this guide, we are going to show you how Kubernetes resource backup works in KubeStash.
How Backup Works
The following diagram shows how KubeStash 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. This secret holds the credentials to access 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 target, 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 backed-up data.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 into thespec.sessions[*].repositories[*].directorypath specified inBackupConfiguration.Then, it creates a
CronJobfor each session with 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 backupJobdefinition.Then, it creates the
Jobto backup the desired resource YAMLs.Then, the Job dumps the Kubernetes Resource YAML, and store them temporarily in a directory. Then, it uploads the content of the directory file to the target storage.
After the backup process is completed, the backup
Jobupdates thestatus.components[*]field of theSnapshotresources.






