KubeBlocks
BlogsKubeBlocks Cloud
⌘K
​

Overview

Introduction
Concepts
Kubernetes and Operator 101
Supported addons
About this manual

Try out KubeBlocks with Playground

Try out KubeBlocks on cloud
Try out KubeBlocks on laptop

Installation

Prerequisite for Local Env

Prerequisite for Local Env
Install kbcli
Install KubeBlocks
Install Addons
Uninstall KubeBlocks and kbcli

Upgrade KubeBlocks

Upgrade to v0.8
Upgrade to v0.9.0
Upgrade to v0.9.3
FAQ

Connect Database

Overview
Testing environment
Production environment

Maintenance

Scale

Horizontal Scale
Vertical Scale

Backup and Restore

Introduction

Backup

Configure BackupRepo
Configure BackupPolicy
Scheduled backup
On-demand backup

Restore

Restore from backup set
PITR

In Place Update

Overview on in-place update
Enable in-place update

Resource Scheduling

Configure pod affinity for database clusters

Cross K8s Deployment

Deploy a Cluster across Multiple Kubernetes Clusters by KubeBlocks

Instance Template

Introduction of instance template
Apply instance template

Observability

Monitor database
Configure alert

User Management

Manage user accounts

Handle an Exception

Handle an exception
Full disk lock

Developer

Developer guides
Terminology

Add an add-on to KubeBlocks

Add-ons of KubeBlocks
Add an add-on
Backup and restore
Parameter template
Parameter configuration
Monitoring
Multi-component configuration
Environment variables and placeholders

External Component

Reference external component

API Reference

Cluster
Backup
Add-On

    Scheduled backup

    KubeBlocks supports configuring scheduled backups for clusters.

    Modify the backup field with kubectl as follows.

    kubectl edit cluster -n default mysql-cluster
    

    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 mysql-cluster --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 mysql-cluster 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-mysql-cluster-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 mysql-cluster
    >
    ...
    Data Protection:
    BACKUP-REPO   AUTO-BACKUP   BACKUP-SCHEDULE   BACKUP-METHOD   BACKUP-RETENTION
    my-repo       Enabled       0 18 * * *        xtrabackup      7d
    

    © 2025 ApeCloud PTE. Ltd.