Skip to content

Making scheduled backups

Backups schedule is defined in the backup section of the Custom Resource and can be configured via the deploy/cr.yaml file.

  1. The backup.enabled key should be set to true,
  2. The backup.storages subsection should contain at least one configured storage.
  3. The backup.tasks subsection allows to actually schedule backups:
    • set the name key to some arbitray backup name (this name will be needed later to restore the bakup).
    • specify the schedule option with the desired backup schedule in crontab format ).
    • set the enabled key to true (this enables making the <backup name> backup along with the specified schedule.
    • set the storageName key to the name of your already configured storage.
    • you can optionally set the keep key to the number of backups which should be kept in the storage.
    • you can optionally set the type key to physical if you would like to make physical backups instead of logical ones (please see the physical backups limitations). Otherwise set this key to logical, or just omit it.

Here is an example of the deploy/cr.yaml with a scheduled Saturday night backup kept on the Amazon S3 storage:

...
backup:
  enabled: true
  storages:
    s3-us-west:
      type: s3
      s3:
        bucket: S3-BACKUP-BUCKET-NAME-HERE
        region: us-west-2
        credentialsSecret: my-cluster-name-backup-s3
  tasks:
   - name: "sat-night-backup"
     enabled: true
     schedule: "0 0 * * 6"
     keep: 3
     type: logical
     storageName: s3-us-west
  ...

Note

If you plan to restore backup to a new Kubernetes-based environment, make sure you will be able to create there a Secrets object with the same user passwords as in the original cluster. More details about secrets can be found in System Users. The name of the current Secrets object you will need to recreate can be found out from the spec.secrets key in the deploy/cr.yaml (my-cluster-name-secrets by default).

Get expert help

If you need assistance, visit the community forum for comprehensive and free database knowledge, or contact our Percona Database Experts for professional support and services. Join K8S Squad to benefit from early access to features and “ask me anything” sessions with the Experts.


Last update: 2024-11-05