From the Longhorn UI, the volume can refer to recurring snapshots and backups as independent jobs or as recurring job groups.
To create a recurring job, you can go to the Recurring Job page in Longhorn and Create Recurring Job or in the volume detail view in Longhorn.
You can configure,
Any groups that the job should belong to
The type of schedule, either backup or snapshot
The time that the backup or snapshot will be created, in the form of a CRON expression
The number of backups or snapshots to retain
The number of jobs to run concurrently
Any labels that should be applied to the backup or snapshot
Recurring jobs can be set up using the Longhorn UI, kubectl, or by using a Longhorn RecurringJob.
To add a recurring job to a volume, you will go to the volume detail view in Longhorn. Then you can set Recurring Jobs Schedule.
Create a new recurring job
Select from existing recurring jobs
Select from existing recurring job groups
Then Longhorn will automatically create snapshots or backups for the volume at the recurring job scheduled time, as long as the volume is attached to a node.
If you want to set up recurring snapshots and backups even when the volumes are detached, see the section Allow Recurring Job While Volume Is Detached
Recurring jobs can be added to a volume using the Longhorn UI, kubectl or by using a Kubernetes StorageClass.
For more information on how snapshots and backups work, refer to the concepts section.
Note: To avoid the problem that recurring jobs may overwrite the old backups/snapshots with identical backups and empty snapshots when the volume doesn’t have new data for a long time, Longhorn does the following:
Recurring backup job only takes a new backup when the volume has new data since the last backup.
Recurring snapshot job only takes a new snapshot when the volume has new data in the volume head (the live data).
Set up Recurring Jobs using the Longhorn UI
Recurring snapshots and backups can be configured from the Recurring Job page or the volume detail page.
Set up Recurring Jobs using a Longhorn RecurringJob
Recurring jobs can also be set up by using a Longhorn RecurringJob.