Create a SUSE® Storage System Backup
System Backup Bundle
Longhorn system backup creates a resource bundle and uploads it to the remote backup target.
It includes below resources associating with the Longhorn system:
-
BackingImages
-
ClusterRoles
-
ClusterRoleBindings
-
ConfigMaps
-
CustomResourceDefinitions
-
DaemonSets
-
Deployments
-
EngineImages
-
PersistentVolumes
-
PersistentVolumeClaims
-
RecurringJobs
-
Roles
-
RoleBindings
-
Settings
-
Services
-
ServiceAccounts
-
StorageClasses
-
Volumes
|
Create a System Backup
You can create a Longhorn system backup using the Longhorn UI. Or with the kubectl
command.
Prerequisites
-
Configure a Backup Target. Longhorn saves the system backups to the remote backup store. You will see an error during creation when the backup target is unset.
Unsetting the backup target clears the existing SystemBackup
custom resource. Longhorn syncs to the remote backup store after setting the backup target. Another cluster can also sync to the same list of system backups when the backup target is the same. -
Create a backup for all volumes (optional).
Longhorn system restores volume with the latest backup. We recommend updating the last backup for all volumes. By taking volume backups, you ensure that the data is up-to-date with the system backup. For more information, please refer to the Configuration - Volume Backup Policy section.
Configuration
Volume Backup Policy
The Longhorn system backup offers the following volume backup policy options:
-
if-not-present
: Longhorn creates a backup for volumes that either lack an existing backup or have an outdated latest backup. -
always
: Longhorn creates a backup for all volumes, regardless of their existing backups. -
disabled
: Longhorn does not create any backups for volumes.
Using Longhorn UI
-
Go to the
System Backup
page in theSetting
drop-down list. -
Click
Create
underSystem Backup
. -
Give a
Name
for the system backup. -
Select a
Volume Backup Policy
for the system backup. -
The system backup will be ready to use when the state changes to
Ready
.
Using kubectl
Command
-
Execute
kubectl create
to create a LonghornSystemBackup
custom resource.apiVersion: longhorn.io/v1beta2 kind: SystemBackup metadata: name: demo namespace: longhorn-system spec: volumeBackupPolicy: if-not-present
-
The system backup will be ready to use when the state changes to
Ready
.> kubectl -n longhorn-system get systembackup NAME VERSION STATE CREATED demo v1.4.0 Ready 2022-11-24T04:23:24Z
Delete Longhorn System Backup
You can delete the Longhorn system backup in the remote backup target using the Longhorn UI. Or with the kubectl
command.
Using Longhorn UI
-
Go to the
System Backup
page in theSetting
drop-down list. -
Delete a single system backup in the
Operation
drop-down menu next to the system backup. Or delete in batch with theDelete
button.Deleting the system backup will also make a deletion in the backup store.
Using kubectl
Command
-
Execute
kubectl delete
to delete a LonghornSystemBackup
custom resource.> kubectl -n longhorn-system get systembackup NAME VERSION STATE CREATED demo v1.4.0 Ready 2022-11-24T04:23:24Z > kubectl -n longhorn-system delete systembackup/demo systembackup.longhorn.io "demo" deleted