VK Cloud logo

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.

Preparation steps

  1. Create a Kubernetes cluster of the latest version, if not done so already.
  2. Make sure that you can connect to the cluster using kubectl.
  3. Install the Velero add-on, if this has not been done yet.

1. Create an application

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.

  1. Create a manifest file specifying the storage class in the availability zone where your worker node group is located:

  2. Apply the manifest in the cluster:

    kubectl apply -f coffee.yaml

    The manifest will create all the Kubernetes resources needed for the application to work in the example-app namespace.

  3. Make sure a disk has been created for the persistent volume:

    1. Find the persistent volume created for the application:

      kubectl get pv -n example-app

      In the output, find the ID of the persistent volume whose CLAIM column shows example-app/coffee-pvc. Example command output:

      NAME                    ...   STATUS   CLAIM                    ......                     ...   ...      ...                      ...<PERSISTENT_VOLUME_ID>  ...   Bound    example-app/coffee-pvc   ...
    2. Get the ID of the disk for the created persistent volume:

      kubectl describe pv <PERSISTENT_VOLUME_ID> -n example-app

      The command output will contain the disk ID in the VolumeHandle parameter. Example output:

      ...Source:    Type:          CSI (a Container Storage Interface (CSI) volume source)    Driver:        cinder.csi.openstack.org    FSType:        ...    VolumeHandle:  <DISK_ID>    ...
    3. Get detailed information about the disk with this ID using the OpenStack CLI:

      openstack volume show <DISK_ID> --fit-width
  4. Wait until the load balancer is assigned a floating IP address.

    Periodically check the load balancer status:

    kubectl get svc -n example-app

    The floating IP address assigned to the load balancer should appear in the EXTERNAL-IP column.

  5. 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.

2. Create a backup schedule

  1. Create the coffee-schedule.yaml manifest:

    apiVersion: velero.io/v1kind: Schedulemetadata:  name: coffee-schedule  namespace: velerospec:  schedule: "*/10 * * * *"  template:    includedNamespaces:      - example-app

    Here:

    • 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.

  2. 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.

3. View the created schedule

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:46Z  Generation:          2  Resource Version:    19702  UID:                 b77cc369-5430-48d0-831c-df057b5e0277Spec:  Schedule:          */10 * * * *  Skip Immediately:  false  Template:    Included Namespaces:      example-appStatus:  Phase:  EnabledEvents:   <none>

4. Perform data restoration from a backup created by schedule

  1. Create the coffee-schedule-restore.yaml manifest:

    apiVersion: velero.io/v1kind: Restoremetadata:  name: coffee-schedule-restore  namespace: velerospec:  scheduleName: coffee-schedule
  2. Apply the manifest in the cluster:

    kubectl apply -f coffee-schedule-restore.yaml

Delete unused resources

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:

  1. Delete the created example-app namespace and its associated resources, as well as the created backup:

    kubectl delete ns example-app
  2. (Optional) Delete the velero namespace. To do this:

    1. Delete the created resource instances related to the addon's Custom Resource Definitions (CRD).

    2. Run the command:

      kubectl delete ns velero
  3. Delete the backups from the bucket that was used by the Velero addon.

    If necessary, also delete the bucket itself.

  4. Stop the cluster you created to use it later or delete it permanently.

Was this article helpful?