KubeBlocks
BlogsKubeBlocks Cloud

Getting Started

Introduction
Supported addons
Installation

Concepts and Features

Concepts

Backup and Restore

Introduction

Backup

Configure BackupRepo
Configure BackupPolicy
Scheduled backup
On-demand backup

Restore

Restore from backup set
Point-in-Time Recovery

In Place Update

Introduction
Enable in-place update

Instance Template

Introduction
Apply instance template

Trouble Shooting

FAQs

References

API Reference

Cluster
Operations
Parameters
Dataprotection
Add-On
Terminology
Install Addons
Install kbcli
Snapshot Controller
Create a test Kubernetes cluster
Kubernetes and Operator 101

Upgrade KubeBlocks

Upgrade to v0.8
Upgrade to v0.9.0
Upgrade to v0.9.x

Release Notes

v1.0.0-cn
v1.0.0
v0.9.3
v0.9.2
v0.9.1
v0.9.0

    Scheduled backup

    KubeBlocks supports configuring scheduled backups for clusters.

    Modify the backup field with kubectl as follows.

    kubectl edit cluster -n default mycluster
    

    Edit the cluster YAML.

    spec:
      ...
      backup:
        # Whether to enable automatic backups
        enabled: true
        # UTC timezone, the example below stands for 2 A.M. every Monday
        cronExpression: 0 18 * * *
        # Use xtrabackup for backups. If your storage supports snapshot, you can change it to volume-snapshot
        method: xtrabackup
        # Whether to enable PITR
        pitrEnabled: false
        # Retention period for a backup set
        retentionPeriod: 7d
        # BackupRepo
        repoName: my-repo
    

    In the above YAML file, you can set whether to enable automatic backups and PITR as needed, and also specify backup methods, repo names, retention periods, etc.

    kbcli cluster update mycluster --backup-enabled=true \
    --backup-method=xtrabackup --backup-repo-name=my-repo \
    --backup-retention-period=7d --backup-cron-expression="0 18 * * *"
    
    • --backup-enabled indicates whether to enable scheduled backups.
    • --backup-method specifies the backup method. You can use the kbcli cluster describe-backup-policy mycluster command to view the supported backup methods.
    • --backup-repo-name specifies the name of the BackupRepo.
    • --backup-retention-period specifies the retention period for backups, which is 7 days in the example.
    • --backup-cron-expression specifies the backup schedule using a cron expression in UTC timezone. Refer to cron for the expression format.

    After the scheduled backup is enabled, execute the following command to check if a CronJob object has been created:

    kubectl get cronjob
    >
    NAME                                        SCHEDULE     SUSPEND   ACTIVE   LAST SCHEDULE   AGE
    96523399-mycluster-default-xtrabackup       0 18 * * *   False     0        <none>          57m
    

    You can also execute the following command to view cluster information, where the Data Protection: section displays the configuration details of automatic backups.

    kbcli cluster describe mycluster
    >
    ...
    Data Protection:
    BACKUP-REPO   AUTO-BACKUP   BACKUP-SCHEDULE   BACKUP-METHOD   BACKUP-RETENTION
    my-repo       Enabled       0 18 * * *        xtrabackup      7d
    

    © 2025 ApeCloud PTE. Ltd.