You can use the backup center to back up and restore applications in Kubernetes clusters across different regions. This provides cross-region disaster recovery for your clusters.
Prerequisites
-
A destination cluster is created. The destination cluster must run version 1.18 or later to ensure that you can restore cloud disk data from ECS snapshots. For more information, see Create an ACK managed cluster, Create an ACK dedicated cluster (no longer available for new creation), or Create a registered cluster and connect to a data center cluster.
ImportantThe destination cluster must use the Container Storage Interface (CSI) storage plugin. You cannot restore data to clusters that use the FlexVolume storage plugin or clusters that use both CSI and FlexVolume plugins through the csi-compatible-controller component.
The backup center focuses on the backup and recovery of business applications. Before you start a restore job, you must install and configure the required system components in the destination cluster. For example:
ACR passwordless component: You must grant permissions and configure acr-configuration for the destination cluster.
ALB Ingress component: You must configure ALBConfig and other settings in advance.
Both the backup cluster and recovery cluster have installed the migrate-controller backup service component and configured permissions.
-
ECS cloud disk snapshots have been enabled.
Enabling the snapshot service is free. After a snapshot is created, you are charged for it based on its size and retention period using the pay-as-you-go billing method. For more information, see Snapshot billing.
Notes
-
Cross-region application migration supports the backup of applications and their associated volumes that use only Alibaba Cloud disks.
If you use an ACK dedicated cluster or a registered cluster that is connected to a self-managed Kubernetes cluster on ECS instances, verify that the required permissions for ECS disk snapshots are granted before you use the cross-region recovery feature for disk volumes. For more information, see Install the migrate-controller backup service component and configure permissions.
-
When you back up an application, resources that are being deleted are not backed up.
Preparations
This topic describes how to back up and restore an application across regions and clusters. In this example, an ACK Pro cluster named Cluster_BJ in the China (Beijing) region is used as the backup cluster. An ACK Pro cluster named Cluster_SZ in the China (Shenzhen) region is used as the recovery cluster. The backup repository is associated with an Object Storage Service (OSS) bucket in the China (Beijing) region.
-
In the China (Beijing) region, create an OSS bucket whose name starts with cnfs-oss-***.
If an OSS bucket that meets the requirements already exists in this region, you can skip this step.
-
Run the following command to create a stateful Nginx application in the default namespace of the Cluster_BJ backup cluster.
Step 1: Create a backup repository
-
The network access method between a backup repository instance in a cluster and its associated OSS bucket is automatically set. The network access method affects the upload and download speeds of application backups.
-
If the cluster and the OSS bucket are in the same region, PrivateLink is used.
-
If the cluster and the OSS bucket are in different regions, a public network connection is used. You must enable public network access for the cluster to access the public endpoint of OSS. For more information, see Enable public network access for a cluster.
-
-
You cannot update a backup repository after it is created. You can only delete it. If you delete a backup repository and then create a new one with the same name, the new repository will not work in clusters that used the original backup repository.
The application backup feature uses Alibaba Cloud OSS to store backup data. If no backup repository is available when you create a backup job, you must follow this step to create one. For more information about how to create a backup repository, see Create a backup repository.
Step 2: Back up the application in the Cluster_BJ cluster
For more information about how to back up an application, see Create a backup schedule or an immediate backup.
The cross-region application migration scenario supports only applications that are stateless or use only Alibaba Cloud disks for storage. For other types of stateful applications, do not select Backup Volume during migration to prevent failures during cross-region recovery.
Step 3: Restore the application in the Cluster_SZ cluster
For more information about how to restore an application, see Step 3: Restore applications and volumes.
Step 4: Check if the Nginx application is migrated
Log on to the Container Service Management Console . In the navigation pane on the left, click Clusters.
-
In the navigation pane on the left of the management page for the Cluster_SZ recovery cluster, choose .
-
Click Details in the Actions column for the Nginx application. Then, click the Pods tab.
Verify that the status of the application is Running. This indicates that the Nginx application is successfully migrated.
References
-
For more information about how to migrate applications between clusters that use different storage plugins or have different versions, see Use the backup center to migrate applications from Kubernetes clusters of earlier versions.
-
For more information about how to use the command line to migrate cluster applications, see Use kubectl to back up and restore cluster applications.