Container Service for Kubernetes (ACK) allows you to back up and restore stateful applications deployed in an ACK cluster. This is an all-in-one solution to achieve crash consistency, application consistency, and cross-region disaster recovery for stateful applications in ACK clusters. This topic describes how to use the application backup feature in the console to back up applications, create snapshots, and restore applications.
- When you back up an application, the resources in the Deleting state are not backed up.
- If you want to use the Hybrid Backup Recovery (HBR) service, Submit a ticket to apply to be added to the whitelist.
- If you want to use snapshots of disk volumes, you must install the Container Storage Interface (CSI) plug-in of V1.1.0 or later. For more information about how to install the CSI plug-in, see Install and upgrade the CSI plug-in.
- If you want to create snapshots of Apsara File Storage NAS (NAS) volumes, which means that you select alibabacloud-cnfs-nas in the Change StorageClass column of the related persistent volume claim (PVC) when you create a snapshot, you must first create a StorageClass. For more information, see Use CNFS to manage NAS file systems.
- For more information about the billing of disks, see Elastic Block Storage devices.
- For more information about the billing of NAS, see NAS billing overview.
- For more information about the billing of HBR, see Billing methods and billable items.
- For more information about the billing of snapshots, see Snapshots.
Step 1: Create a backup vault
- Log on to the ACK console.
- In the left-side navigation pane of the ACK console, choose .
- On the Backup Center page, click Create.
- In the Create panel, set the following parameters and click OK.
Parameter Description Vault Name The name of the backup vault. The name can contain lowercase letters and digits. OSS Bucket Region The region where the OSS bucket that you want to use is deployed. OSS Bucket Name The name of the OSS bucket. If you use an ACK managed cluster, the name of the OSS bucket must start with cnfs-oss***. You can claim a bucket by using CNFS OSS. OSS Bucket Subdirectory The subdirectory of the OSS bucket. This parameter is optional.
Step 2: Create a backup task
- On the Backup Center page, select a cluster from the Cluster drop-down list.
- Click Create Backup Plan.
- In the Create Backup Plan panel of the Application Backup page, set the following parameters and click OK.
Parameter Description Name The name of the backup task. This parameter is required. Backup Vaults Select the backup vault that you want to use. This parameter is required. Backup Namespaces You can select one or more namespaces. Applications in the selected namespaces are backed up. This parameter is required. Label Specify a label. Applications with the specified label are backed up. Excluded Namespaces You can select one or more namespaces that you want to exclude from the backup task. Applications in the excluded namespaces are not backed up. Specify Resources You can specify one or more Kubernetes resources, and separate them with commas (,), for example,
deploy, configmap. Only the specified Kubernetes resources are backed up.
Excluded Resources You can specify one or more Kubernetes resources that you want to exclude from the backup task, and separate them with commas (,), for example,
pod, secret. The excluded resources are not backed up.
Volume Backup Specify whether to enable volume backup. You can enable this feature to back up the application data stored in the relevant volume.
If you select Volume Backup, this feature is enabled. If the application data is stored in disks, the data is backed up by creating volume snapshots. If the application data is not stored in disks, the data is backed up by using HBR.
Validity Period Specify the retention period of backup files. Backup files cannot be restored after they expire. Backup Type You can select Back up Now or Scheduled Backup.
If you select Scheduled Backup, you must specify a backup cycle. You can enter a cron expression to set a backup schedule. For more information about how to use cron expressions, see how-use-cron-linux.Note
On the Backups and Snapshots tab, if the status of the backup task is Completed, the backup is created.
- The name of the backup task can contain only lowercase letters and digits, and cannot contain space characters.
- You can select or exclude more than one namespace.
- You can specify only one resource label in each backup task.
- Volume snapshots are created by using the snapshot feature for Alibaba Cloud disks while HBR is a fully managed service that offers improved efficiency, security, and cost savings in backup and storage.
- You can set a backup schedule by entering a cron expression or a backup interval.
- After you enable scheduled backup, you can view the details about scheduled backups on the Backup Plans tab of the Application Backup page.
Step 3: Create snapshots for volumes of CNFS types
- On the Application Backup page, click the Backups and Snapshots tab.
- Find the backup task that you created and click Create Snapshot in the Actions column.
- In the Create Snapshot dialog box, select the PVC that you want to convert and select the related storage
type from the drop-down list in the Change StorageClass column. Then, click Create Snapshot. Note You need to select the PVC that you want to convert and select the related storage type from the drop-down list. Otherwise, the snapshot created cannot be restored.NAS volumes (alibabacloud-cnfs-nas) and disk volumes (alicloud-disk) are supported.After the status of the related PVC changes to ConvertionCompleted, the snapshot is created, as shown in the following figure.
Step 4: Restore the application and volume
- On the Application Backup page, click the Restore tab.
- On the Restore tab, click Create Restoration Task.
- In the Create Restoration Task panel, set the following parameters and click OK.
Parameter Description Name The name of the restoration task. The name can contain only lowercase letters and digits. Backup Vaults Select the backup vault where backup files are stored. Select Backup Select a backup file. Reset Namespace If you want to select backup files in other namespaces, click Add, select the namespace to which the backup files belong, and then specify the namespace to which the backup files are restored after the colon (:).Note The system does not overwrite existing resources in the cluster when it restores data. It restores only resources that do not exist in the cluster. Before you can restore an application to an earlier version, you must delete the existing resources of the application.
- In the lower-left corner of the panel, click OK.
- Verify that the related stateful or stateless application, volumes, and Services can
be started and accessed as normal.
- In the left-side navigation pane of the details page of the cluster to which you want to restore the application, choose .
- Find the application and click Details in the Actions column. On the Pods tab, verify that the application is in the Running state.
- In the left-side navigation pane of the details page, choose . On the Persistent Volume Claims page, you can view the PVC that is restored.
- In the left-side navigation pane of the details page, choose .
- On the Services page, click the external endpoint to check whether the Service can be accessed.