Use the backup center to back up and restore applications in ACK clusters across regions for disaster recovery.
Before you begin
Review these constraints before proceeding.
| Constraint | Detail |
|---|---|
| Storage type | Supports only applications and volumes on Alibaba Cloud disks. Other storage types cannot migrate with volume data intact. |
| Stateful apps with non-Alibaba Cloud storage | Clear Backup Volume for these applications. Otherwise, cross-region recovery fails. |
| Destination cluster version | The destination cluster must run Kubernetes 1.18 or later to restore cloud disk data from Elastic Compute Service (ECS) snapshots. |
| Destination cluster storage plugin | The destination cluster must use the Container Storage Interface (CSI) storage plugin. Clusters using FlexVolume, or both CSI and FlexVolume via csi-compatible-controller, are not supported. |
| Resources being deleted | Resources being deleted during backup are excluded. |
| Backup repository immutability | Backup repositories are immutable after creation and can only be deleted. Recreating one with the same name does not work in clusters that used the original. |
| ACK dedicated and registered clusters | For self-managed Kubernetes clusters on ECS, verify ECS disk snapshot permissions before using cross-region volume recovery. See Install the migrate-controller backup service component and configure permissions. |
Prerequisites
Make sure you have:
-
A destination cluster running Kubernetes 1.18 or later (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).
-
A destination cluster that uses the CSI storage plugin.
-
System components installed in the destination cluster before restoring:
-
ACR passwordless add-on: Grant permissions and configure
acr-configuration. -
ALB Ingress add-on: Configure
ALBConfigand other settings.
-
-
The
migrate-controlleradd-on installed and permissions configured on both clusters. See Install the migrate-controller backup service component and configure permissions. -
ECS cloud disk snapshots enabled. See Enable ECS cloud disk snapshots. The snapshot service is free to enable. Snapshots incur pay-as-you-go charges based on size and retention. See Snapshot billing.
Preparations
This example uses the following setup:
-
Backup cluster: ACK Pro cluster Cluster_BJ in the China (Beijing) region
-
Recovery cluster: ACK Pro cluster Cluster_SZ in the China (Shenzhen) region
-
Backup repository: Associated with an OSS bucket in the China (Beijing) region
Step 1: In the China (Beijing) region, create an OSS bucket with a name that starts with cnfs-oss-***.
If a qualifying OSS bucket already exists in this region, skip this step.
Step 2: Create a stateful Nginx application in the default namespace of Cluster_BJ.
cat << EOF | kubectl apply -f -
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: web
spec:
selector:
matchLabels:
app: nginx
serviceName: "nginx"
replicas: 1
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
name: web
volumeMounts:
- name: www
mountPath: /usr/share/nginx/html
volumeClaimTemplates:
- metadata:
name: www
labels:
app: nginx
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: "alicloud-disk-topology-alltype"
resources:
requests:
storage: 20Gi
EOF
Step 1: Create a backup repository
The backup center stores backup data in OSS. Create a repository if none exists.
-
The network between a backup repository and its OSS bucket is configured automatically, affecting backup upload and download speeds.
-
Same region (cluster and OSS bucket): PrivateLink is used.
-
Different regions (cluster and OSS bucket, as in cross-region scenarios): Uses a public network connection. Enable public network access before proceeding. See Enable public network access for a cluster.
-
-
Backup repositories are immutable after creation and can only be deleted. Recreating one with the same name does not work in clusters that used the original.
Step 2: Back up the application in Cluster_BJ
Cross-region migration supports only stateless applications and stateful applications using Alibaba Cloud disks exclusively. For other stateful applications, clear Backup Volume to prevent recovery failures.
Step 3: Restore the application in Cluster_SZ
Step 4: Verify the migration
Confirm the Nginx application is running correctly in Cluster_SZ.
Using kubectl:
kubectl get pods -n default
kubectl get pvc -n default
Confirm the Pod status is Running and the PersistentVolumeClaim (PVC) is Bound.
Using the console:
-
Log on to the Container Service Management Console. In the left-side navigation pane, click Clusters.
-
On the Cluster_SZ management page, in the left-side navigation pane, choose Workloads > StatefulSets.
-
In the Actions column for the Nginx application, click Details, then click the Pods tab. Confirm the application status is Running.
Next steps
-
To migrate between clusters with different storage plugins or Kubernetes versions, see Use the backup center to migrate applications from Kubernetes clusters of earlier versions.
-
To migrate applications with the command line, see Use kubectl to back up and restore cluster applications.