Getting Started
Concepts and Features
Backup and Restore
In Place Update
Instance Template
Trouble Shooting
References
Upgrade KubeBlocks
Getting Started
Concepts and Features
Backup and Restore
In Place Update
Instance Template
Trouble Shooting
References
Upgrade KubeBlocks
KubeBlocks supports on-demand backups. You can customize your backup method by specifying --method
. The instructions below take using a backup tool and volume snapshot as examples.
The following command uses the xtrabackup
backup method to create a backup named mybackup
.
To Create a backup:
kubectl apply -f - <<EOF
apiVersion: dataprotection.kubeblocks.io/v1alpha1
kind: Backup
metadata:
name: mybackup
namespace: default
spec:
backupMethod: xtrabackup
backupPolicyName: mycluster-mysql-backup-policy
deletionPolicy: Delete
EOF
View the backup:
kubectl get backup mybackup
>
NAME POLICY METHOD REPO STATUS TOTAL-SIZE DURATION DELETION-POLICY CREATION-TIME COMPLETION-TIME EXPIRATION-TIME
mybackup mycluster-mysql-backup-policy xtrabackup kb-oss Completed 1632402 10s Delete 2025-05-26T10:14:33Z 2025-05-26T10:14:42Z
Create a backup
kbcli cluster backup mycluster --name mybackup --method xtrabackup
>
Backup mybackup created successfully, you can view the progress:
kbcli cluster list-backups --names=mybackup -n default
View the backup
kbcli cluster list-backups --names mybackup
>
NAME NAMESPACE SOURCE-CLUSTER METHOD STATUS TOTAL-SIZE DURATION DELETION-POLICY CREATE-TIME COMPLETION-TIME EXPIRATION
mybackup default mycluster xtrabackup Completed 1632402 10s Delete May 26,2025 18:14 UTC+0800 May 26,2025 18:14 UTC+0800
Prerequisites Volume snapshot backups require:
Please check the list of CS Drivers and their features at: https://kubernetes-csi.github.io/docs/drivers.html
To create a backup using the snapshot, the backupMethod
in the YAML configuration file or the --method
field in the kbcli command should be set to volume-snapshot
.
# Create a backup
kubectl apply -f - <<EOF
apiVersion: dataprotection.kubeblocks.io/v1alpha1
kind: Backup
metadata:
name: my-snapshot-backup
namespace: default
spec:
backupMethod: volume-snapshot
backupPolicyName: mycluster-mysql-backup-policy
EOF
View the backup
kubectl get backup my-snapshot-backup
>
NAME POLICY METHOD REPO STATUS TOTAL-SIZE DURATION DELETION-POLICY CREATION-TIME COMPLETION-TIME EXPIRATION-TIME
my-snapshot-backup mycluster2-mysql-backup-policy volume-snapshot Running Delete 2025-05-26T10:30:10Z
# Create a backup
kbcli cluster backup mycluster --name my-snapshot-backup --method volume-snapshot
>
Backup mybackup created successfully, you can view the progress:
kbcli cluster list-backups --names=mybackup -n default
# View the backup
kbcli cluster list-backups --names=my-snapshot-backup -n default
>
NAME NAMESPACE SOURCE-CLUSTER METHOD STATUS TOTAL-SIZE DURATION DELETION-POLICY CREATE-TIME COMPLETION-TIME EXPIRATION
my-snapshot-backup default mycluster volume-snapshot Running Delete May 26,2025 18:30 UTC+0800
When creating backups using snapshots, ensure that the storage used supports the snapshot feature; otherwise, the backup may fail.
Backups created manually using kbcli
will not be automatically deleted. You need to manually delete them.