Scheduled backup
Use the Velero add-on to configure cluster backups on a given schedule in cron format and to restore a cluster based on that schedule.
- Create a Kubernetes cluster of the latest version, if not done so already.
- Make sure that you can connect to the cluster using
kubectl. - Install the Velero add-on, if this has not been done yet.
To get familiar with creating a backup and restoring from it, create the coffee demo application. A persistent volume will be attached to this application.
-
Create a manifest file specifying the storage class in the availability zone where your worker node group is located:
-
Apply the manifest in the cluster:
kubectl apply -f coffee.yamlThe manifest will create all the Kubernetes resources needed for the application to work in the
example-appnamespace. -
Make sure a disk has been created for the persistent volume:
-
Find the persistent volume created for the application:
kubectl get pv -n example-appIn the output, find the ID of the persistent volume whose
CLAIMcolumn showsexample-app/coffee-pvc. Example command output:NAME ... STATUS CLAIM ...... ... ... ... ...<PERSISTENT_VOLUME_ID> ... Bound example-app/coffee-pvc ... -
Get the ID of the disk for the created persistent volume:
kubectl describe pv <PERSISTENT_VOLUME_ID> -n example-appThe command output will contain the disk ID in the
VolumeHandleparameter. Example output:...Source:Type: CSI (a Container Storage Interface (CSI) volume source)Driver: cinder.csi.openstack.orgFSType: ...VolumeHandle: <DISK_ID>... -
Get detailed information about the disk with this ID using the OpenStack CLI:
openstack volume show <DISK_ID> --fit-width
-
-
Wait until the load balancer is assigned a floating IP address.
Periodically check the load balancer status:
kubectl get svc -n example-appThe floating IP address assigned to the load balancer should appear in the
EXTERNAL-IPcolumn. -
Make sure NGINX responds to requests:
curl <FLOATING_IP_ADDRESS_OF_LOAD_BALANCER>Expected output:
The coffee pod says Hello World to everyone! This file is located on the dynamically claimed Cinder ReadWriteOnce persistent volume.
-
Create the
coffee-schedule.yamlmanifest:apiVersion: velero.io/v1kind: Schedulemetadata:name: coffee-schedulenamespace: velerospec:schedule: "*/10 * * * *"template:includedNamespaces:- example-appHere:
-
coffee-schedule— the name of the schedule, which you will later be able to find in the list of backup schedules. -
velero— the cluster namespace for which you are configuring the schedule. -
schedule— the parameter that sets the backup creation time in cron format, for example*/10 * * * *— every 10 minutes. Each character is responsible for a specific time value.
-
-
Apply the manifest in the cluster:
kubectl apply -f coffee-schedule.yaml
As a result of this schedule, backups will be created every 10 minutes. The name of each backup will be in the format <SCHEDULE_NAME>-<TIMESTAMP>, where <TIMESTAMP> is its creation time. Example name: daily-backup-20260805070000.
The default backup retention period is 72 hours. After this time, the backup will be deleted.
Check the parameters of the created schedule using the command:
kubectl -n velero describe schedule coffee-schedule
Example of the command output:
Name: coffee-scheduleNamespace: veleroLabels: <none>Annotations: <none>API Version: velero.io/v1Kind: ScheduleMetadata:Creation Timestamp: 2026-08-03T09:25:46ZGeneration: 2Resource Version: 19702UID: b77cc369-5430-48d0-831c-df057b5e0277Spec:Schedule: */10 * * * *Skip Immediately: falseTemplate:Included Namespaces:example-appStatus:Phase: EnabledEvents: <none>
-
Create the
coffee-schedule-restore.yamlmanifest:apiVersion: velero.io/v1kind: Restoremetadata:name: coffee-schedule-restorenamespace: velerospec:scheduleName: coffee-schedule -
Apply the manifest in the cluster:
kubectl apply -f coffee-schedule-restore.yaml
A running cluster is billed and consumes computing resources. If you no longer need the Kubernetes resources created to test backups with the Velero addon, delete them:
-
Delete the created
example-appnamespace and its associated resources, as well as the created backup:Linux/macOSWindowskubectl delete ns example-app -
(Optional) Delete the
veleronamespace. To do this:-
Delete the created resource instances related to the addon's Custom Resource Definitions (CRD).
-
Run the command:
Linux/macOSWindowskubectl delete ns velero
-
-
Delete the backups from the bucket that was used by the Velero addon.
If necessary, also delete the bucket itself.
-
Stop the cluster you created to use it later or delete it permanently.