All Products
Search
Document Center

Container Service for Kubernetes:Use a registered cluster to back up and restore applications across clusters that belong to different accounts

Last Updated:Nov 03, 2026

Connect the backup cluster to a registered cluster in the restore account and grant permissions on cloud services such as Object Storage Service (OSS). Then back up and restore Container Service for Kubernetes (ACK) clusters in different accounts as if they were in the same account.

How it works

image

What is backed up

Before you create a backup task, check whether Backup Center backs up the data that your application stores.

Resource type

Backed up

Notes

Kubernetes resources (StatefulSet, Deployment, pod, Service, ConfigMap, Secret, Ingress, CronJob, PersistentVolumeClaim (PVC), PersistentVolume (PV), and so on)

Yes

—

NAS volumes (Cloud Backup)

Yes

Cannot be backed up or restored across accounts through VPCs

Disk volumes (Cloud Backup or ECS snapshot)

Yes

The ECS snapshot solution requires additional cross-account steps

OSS volumes

No

Restored by pointing the PVC and PV at the original OSS bucket with the AccessKey pair of the backup account

Resources that are being deleted

No

—

Considerations

  • To restore data across regions, create a registered cluster under the restore account in the same region as the restore cluster. The backup cluster connects to the registered cluster over the Internet. Backup data is uploaded to the cloud over the Internet, and data is restored from the cloud to the restore cluster over the internal network.

  • The backup cluster and the restore cluster must run Kubernetes 1.16 or later. Because of apiVersion compatibility, avoid using Backup Center to migrate applications from a cluster that runs a later Kubernetes version to a cluster that runs an earlier version.

  • The backup center does not back up resources that are being deleted.

  • (For restoring to NAS volumes managed by CNFS) A StorageClass with alibabacloud-cnfs-nas is created.

  • When an application is restored, resources are preferentially restored using the recommended apiVersion for the Kubernetes version of the restore cluster. If a resource does not have an apiVersion that is supported by both cluster versions, you must manually deploy that resource. For example:

    • A Deployment in a Kubernetes 1.16 cluster supports the extensions/v1beta1, apps/v1beta1, apps/v1beta2, and apps/v1 API versions. When restored to a Kubernetes 1.28 cluster, it is restored by using apps/v1.

    • An Ingress in a Kubernetes 1.16 cluster supports the extensions/v1beta1 and networking.k8s.io/v1beta1 API versions. You cannot directly restore it to a cluster that runs Kubernetes 1.22 or later.

    For more information about API changes across Kubernetes versions, see ACK release notes and Deprecated API Migration Guide.

    Important

    In a Kubernetes 1.16 cluster, API groups such as apps and rbac.authorization.k8s.io already support v1. When you migrate applications to a Kubernetes 1.28 cluster, you must manually restore resources such as Ingress and CronJob.

  • The Backup Center installation template for a registered cluster differs from the template for an ACK managed cluster. To keep using Backup Center after you connect the backup cluster to or disconnect it from a registered cluster, reinstall the Backup Center add-on in the registered cluster (after connecting) or in the backup cluster (after disconnecting).

  • Snapshots created by the Elastic Compute Service (ECS) snapshot feature for cloud disk backups in a registered cluster belong to the backup account and cannot be restored directly in the restore account. For applications that use cloud disk volumes, use the snapshot sharing feature of ECS to restore the data manually, or modify the global configuration before the backup to back up cloud disk data by using the Cloud Backup solution. For more information, see Step 4: Create a restore task in the restore cluster.

Prerequisites

Billing

The backup center is free. Related services incur charges based on usage:

  • Object Storage Service (OSS): Stores backup YAML files. See OSS billing.

  • Snapshots: Backs up disk volumes. See Snapshot billing.

    Starting 11:00 (UTC+8) on October 12, 2023, storage fees and feature usage fees for the instant access feature are no longer charged. See Use the instant access feature. Snapshots created during backups of PL0 ESSD, PL1 ESSD, PL2 ESSD, PL3 ESSD, and ESSD AutoPL disks have the instant access feature enabled by default.
  • Cloud Backup: Backs up non-disk volumes. See Cloud Backup price details.

Sample applications

The following scenario shows how to back up and restore application data in a cluster.

The backup cluster contains the following applications:

Application

Mounted volumes

Application characteristics

Data backup required

sts-disk

  • The sts-disk application, which uses a cloud disk volume

  • The Persistent Volume Claim (PVC) is named pvc-disk

Requires strong data consistency. Write operations are suspended before the backup.

Yes (Cloud Backup or ECS snapshot)

sts-nas

  • The sts-nas application, which uses a File Storage NAS volume

  • The PVC is named pvc-nas

Does not require strong data consistency and accepts that data written during the backup may be lost.

No cross-account Virtual Private Cloud (VPC) connection is planned, so the restore cluster cannot read the data in the original NAS file system.

Yes (Cloud Backup)

sts-oss

  • The sts-oss application, which uses an OSS volume

  • The PVC is named pvc-oss

Stores a large amount of data and continues to use the original bucket through an AccessKey pair authorized by the backup account. The Secret that stores the AccessKey pair is backed up and restored into the restore account, so restrict the AccessKey pair to the original bucket and rotate it after the migration.

No (restore directly from the original PVC and PV YAML, which points to the original OSS bucket)

For information about how to create applications that use different volume types, see Storage - CSI.

(Optional) Step 1: Uninstall Backup Center in the backup cluster

Backup Center is provided by the migrate-controller add-on. If you have used Backup Center in the backup cluster, uninstall the Backup Center add-on in the backup cluster first. If the migrate-controller add-on is not installed in the backup cluster, skip this step. For more information, see Considerations.

Warning
  • Uninstalling the migrate-controller add-on stops Backup Center in the backup cluster. Scheduled backup plans stop running, and the cluster is not protected until you reinstall the add-on.

  • Before you uninstall the add-on, make sure that no backup or restore task is in progress.

  • After the add-on is uninstalled, you must reinstall it with the template that matches the cluster type before Backup Center works in the cluster again.

  1. Log on to the ACK console with the backup account. In the left-side navigation pane, choose Clusters.

  2. On the Clusters page, click the name of the backup cluster. In the left-side navigation pane, click Add-ons.

  3. On the Add-ons page, click the Manage Applications tab.

  4. Find the migrate-controller add-on card and click Uninstall in the lower-right corner.

  5. In the Uninstall dialog box, click OK to uninstall the add-on.

Step 2: Install Backup Center in the registered cluster

  1. With the restore account, follow the instructions in Create an ACK One registered cluster, and connect the backup cluster to the registered cluster.

  2. In the registered cluster, follow the instructions in Install migrate-controller and configure permissions.

    Note

    Because the backup cluster is an ACK cluster deployed in the cloud in the same region, you do not need to configure a route for the OSS internal network CIDR block.

Step 3: Create a backup task in the registered cluster

Important

Perform all the steps in the registered cluster under the restore account. Do not switch to the backup cluster under the backup account.

Compared with Cloud Backup (HBR), the ECS snapshot feature provides faster backups with stronger consistency. However, snapshots created by the ECS snapshot feature for cloud disk backups in a registered cluster belong to the backup account and cannot be restored directly in the restore account.

For sts-disk, an application that uses a cloud disk volume, two methods are available to restore data across accounts:

Backup solution

Cloud Backup solution

ECS snapshot solution

How it works

Before the backup, configure the csdr-config ConfigMap in the csdr namespace to use Cloud Backup to back up the data on cloud disks.

During the restore, use StorageClass conversion to restore the data as cloud disk volumes.

Use the default ECS snapshot feature to back up cloud disk data, and use the snapshot sharing feature of ECS to share the created snapshots from the backup account with the restore account.

Before you restore through Backup Center, manually create VolumeSnapshot resources in the cluster by using static provisioning and recreate all cloud disk PVCs to ensure that the cloud disks are created and mounted correctly.

Advantages

Requires almost no additional manual operations.

ECS cloud disk snapshots ensure data consistency for each disk and provide faster backup and restore.

Disadvantages

Cloud Backup has a longer backup and restore duration and does not guarantee data consistency. If an application requires strong data consistency, write operations must be suspended for a long time.

Manual operations become cumbersome when many cloud disks are involved.

Use when

Your application does not require strict data consistency, or your application has many cloud disk volumes.

Your application uses cloud disk volumes, requires data consistency, and you are ready to share snapshots across accounts.

Note

If your applications do not use cloud disk volumes, back up the data by using the Cloud Backup solution.

Cloud Backup solution

Choose the Cloud Backup solution when your application does not require strict data consistency, or when your application has no cloud disk volumes. If your applications use cloud disk volumes and you want to use the Cloud Backup solution for cloud disk backups, perform the following operations.

  1. Make sure that the ECS snapshot feature is turned off.

    1. Run the following command to edit csdr-config.

      kubectl -ncsdr edit cm csdr-config 
    2. Verify that the enable_ecs_snapshot parameter is set to false; otherwise, modify the value, save the change, and exit.

    3. If you modified the configuration, run the following command to restart the working component so that the configuration takes effect.

      kubectl -ncsdr delete pod -l control-plane=csdr-controller
  2. If the restore account does not have a backup vault, create one and associate it with an OSS bucket in the restore account whose name uses the cnfs-oss-* format. For more information, see Create a backup vault.

  3. Create a backup for sts-oss. For more information, see Create a backup plan or back up immediately.

    • Because the sts-oss application needs to use the original OSS bucket, the data in the OSS volume does not need to be backed up. Create a separate backup for the application. When you create the backup task, set Backup Volume to Disable.

    • Assume that sts-oss runs in a namespace named oss. For the backup, select only the applications in the namespace named oss. If sts-oss runs in the same namespace as other applications, specify labels to select the applications to back up.

    • On the Application Backup page, on the Backup Records tab, verify that the status of the related backup task changes from InProgress to Completed. Click the name of the backup record and verify that the resources related to sts-oss, such as the StatefulSet, pods, PVCs, PVs, and the Secret that stores the AccessKey pair, are all backed up.

    Warning
    • The sts-oss backup includes the Secret that stores the AccessKey pair of the backup account. After the restore, this Secret and the AccessKey pair it contains are stored in the restore account, and can be read by anyone who has access to the backup vault and the associated cnfs-oss-* OSS bucket in that account.

    • Use the AccessKey pair of a RAM user that is authorized only on the original OSS bucket. Do not use the AccessKey pair of the Alibaba Cloud account.

    • After the migration is complete, rotate or disable the AccessKey pair. Otherwise the restore account keeps access to the original OSS bucket.

  4. Create backups for the sts-nas and sts-disk applications. For more information, see Create a backup plan or back up immediately.

    • When you create the backup task, set Backup Volume to Mounted Volumes.

    • Because enable_ecs_snapshot is set to false, the data in cloud disk volumes is also backed up by Cloud Backup. In the Cloud Backup console, in the left-side navigation pane, click Container Backup. On the Backup Jobs tab, view the backup progress and result of each PVC.

ECS snapshot solution

Choose the ECS snapshot solution when your application uses cloud disk volumes and requires data consistency. If your applications use cloud disk volumes and you want to use the ECS snapshot solution for cloud disk backups, perform the following operations.

  1. Make sure that the ECS snapshot feature is turned on.

    1. Run the following command to edit csdr-config.

      kubectl -ncsdr edit cm csdr-config 
    2. Verify that the enable_ecs_snapshot parameter is set to true; otherwise, modify the value, save the change, and exit.

    3. If you modified the configuration, run the following command to restart the working component so that the configuration takes effect.

      kubectl -ncsdr delete pod -l control-plane=csdr-controller
  2. If the restore account does not have a backup vault, create one and associate it with an OSS bucket in the restore account whose name uses the cnfs-oss-* format. For more information, see Create a backup vault.

  3. Create a backup for sts-oss. For more information, see Create a backup plan or back up immediately.

    • Because the sts-oss application needs to use the original OSS bucket, the data in the OSS volume does not need to be backed up. Create a separate backup for the application. When you create the backup task, set Backup Volume to Disable.

    • Assume that sts-oss runs in a namespace named oss. For the backup, select only the applications in the namespace named oss. If sts-oss runs in the same namespace as other applications, specify labels to select the applications to back up.

    • On the Application Backup page, on the Backup Records tab, verify that the status of the related backup task changes from InProgress to Completed. Click the name of the backup record and verify that the resources related to sts-oss, such as the StatefulSet, pods, PVCs, PVs, and the Secret that stores the AccessKey pair, are all backed up.

    Warning
    • The sts-oss backup includes the Secret that stores the AccessKey pair of the backup account. After the restore, this Secret and the AccessKey pair it contains are stored in the restore account, and can be read by anyone who has access to the backup vault and the associated cnfs-oss-* OSS bucket in that account.

    • Use the AccessKey pair of a RAM user that is authorized only on the original OSS bucket. Do not use the AccessKey pair of the Alibaba Cloud account.

    • After the migration is complete, rotate or disable the AccessKey pair. Otherwise the restore account keeps access to the original OSS bucket.

  4. Create a backup for the sts-nas and sts-disk applications, named backup-nas-disk. For more information, see Create a backup plan or back up immediately.

    • When you create the backup task, set Backup Volume to Mounted Volumes.

    • By default, the data in cloud disk volumes is backed up by using ECS snapshots. In the ECS console, in the left-side navigation pane, click Snapshot. On the Disk Snapshot tab, view the snapshot of each cloud disk.

    • By default, the data in NAS volumes is backed up by Cloud Backup. In the Cloud Backup console, in the left-side navigation pane, click Container Backup. On the Backup Jobs tab, view the backup progress and result of each PVC.

Step 4: Create a restore task in the restore cluster

Important
  • Before you create a restore task, install and configure the required add-ons in the restore cluster. For example:

    • Container Registry (ACR) password-free add-on: Grant permissions again for the restore cluster and configure acr-configuration.

    • ALB Ingress add-on: Configure resources such as an AlbConfig in advance.

  • Restores are non-destructive. If a resource with the same name already exists in the restore cluster, the restore task skips the resource. Verify the restored resources after the task succeeds. A skipped resource keeps its existing configuration, so a successful task does not mean the backed-up specification was applied.

Note
  • If your applications do not use cloud disk volumes, restore the data by using the Cloud Backup solution.

  • When Service resources are restored, the following adaptations are made based on the Service type:

    • NodePort Service: Port numbers are retained by default when you restore across clusters.

    • LoadBalancer Service: If spec.externalTrafficPolicy is set to Local, spec.healthCheckNodePort uses a random port number by default. To retain port numbers, set spec.preserveNodePorts: true in the ApplicationRestore resource when you create the restore task. For more information about the resource, see Back up and restore applications with kubectl.

    • For a Service in the backup cluster that is associated with a specified existing Server Load Balancer (SLB) instance, the restore uses the original SLB instance and disables forced listening by default. Configure listeners in the SLB console.

    • For a Service in the backup cluster whose SLB instance is managed by CCM, CCM creates a new SLB instance during the restore. For more information, see Considerations for configuring Service load balancing.

Cloud Backup solution

Use the restore account to perform the following steps in the restore cluster.

  1. Create a restore task to restore the sts-oss application. For more information, see Restore applications and volumes.

    1. On the Application Backup page, click Restore, select and initialize a backup vault, and wait for the backups to synchronize to the restore cluster.

    2. Select the backup backup-oss and create a restore task.

    3. In the restore cluster, verify that sts-oss is restored. Run the kubectl exec command to enter the container and check whether the data is consistent.

  2. Create a restore task to restore the sts-nas and sts-disk applications, and use StorageClass conversion to restore the storage type of the data. For more information, see Restore applications and volumes.

    1. On the Application Backup page, click Restore, and select the backup backup-nas-disk. Select the StorageClass alicloud-disk for pvc-disk and the StorageClass alibabacloud-cnfs-nas for pvc-nas.

      By default, alicloud-disk refers to the alicloud-disk-topology-alltype StorageClass provided by CSI. Alternatively, create a custom StorageClass in the cluster for the conversion.

    2. In the restore cluster, verify that the applications and data are normal. In the ECS console, check whether new cloud disks are created under the restore account and mounted on the corresponding nodes.

ECS snapshot solution

  1. Use the restore account to create a restore task in the restore cluster to restore the sts-oss application. For more information, see Restore applications and volumes.

    1. On the Application Backup page, click Restore, select and initialize a backup vault, and wait for the backups to synchronize to the restore cluster.

    2. Select the backup backup-oss and create a restore task.

    3. In the restore cluster, verify that sts-oss is restored. Run the kubectl exec command to enter the container and check whether the data is consistent.

  2. Switch to the backup account. In the ECS console, share the snapshots with the restore account. For more information, see Share snapshot.

    Snapshots created by Backup Center are prefixed with "snapshot-". Identify the target snapshots by the creation time of the backup records.

  3. To facilitate the manual restore of cloud disk volumes later, record the following mappings under the backup account:

    1. In the ECS console, query and record the mapping between the created snapshot IDs and the cloud disk IDs.

    2. In the backup cluster, query and record the cloud disk PVCs and their corresponding cloud disk IDs.

      Run the following command to obtain both the PVC information and the cloud disk information of a cloud disk PV:

      kubectl get pv <PV-Name> -o jsonpath='{"PVC: "}{.spec.claimRef.name}{"\nNamespace: "}{.spec.claimRef.namespace}{"\nVolumeHandle: "}{.spec.csi.volumeHandle}'

      The expected output is similar to:

      PVC: <disk-pvc-name>
      Namespace: <disk-pvc-namespace>
      VolumeHandle: d-2ze323ra0h2v5lxxxxx

      PVC and Namespace are the name of the cloud disk PVC and the namespace in which it resides. VolumeHandle is the ID of the cloud disk created by the backup.

    3. Combine the preceding information to establish the mapping between each cloud disk PVC and the corresponding snapshot ID.

  4. Switch to the restore account. In the Resource Sharing console, accept the shared snapshots. For more information, see Share snapshot.

    After a snapshot is shared with the restore account, its name remains unchanged but its snapshot ID changes.

    Obtain the mapping between the old and new snapshot IDs by snapshot name. Combine this mapping with the mappings recorded in step 3 of this list to establish the mapping between each cloud disk PVC and the new shared snapshot ID.

  5. Manually restore the cloud disk volumes in the restore cluster. To restore a single volume, perform the following steps:

    1. Create VolumeSnapshotContent and VolumeSnapshot resources in the restore cluster by using static provisioning. For more information, see Create a snapshot of a disk volume. The VolumeSnapshot resource must be in the same namespace as the PVC, and snapshotHandle in VolumeSnapshotContent must be the new shared snapshot ID.

    2. Create a PVC with the same name as the original PVC from the VolumeSnapshot. For more information, see Step 6 in Create a snapshot of a disk volume. Except for the added dataSource field, the other settings should be the same as those of the original PVC.

  6. Create a restore task in the restore cluster to restore the sts-nas and sts-disk applications. For more information, see Restore applications and volumes.

    Because the volumes used by the sts-disk application have already been restored, this restore skips those volumes by default. During the restore, the workload of the sts-disk application automatically mounts the PVCs with the same names.

    1. On the Application Backup page, click Restore, and select the backup backup-nas-disk. If you do not select StorageClass conversion, the original StorageClass is used by default for the restore. Before the restore, make sure that the StorageClass exists.

    2. In the restore cluster, verify that the applications and data are normal. In the ECS console, check whether new cloud disks are created under the restore account and mounted on the corresponding nodes.

(Optional) Step 5: Disconnect the backup cluster from the registered cluster and redeploy the add-on

  • If you no longer need cross-account backup and restore, remove the backup cluster from the registered cluster.

  • If you want to continue using Backup Center in the backup cluster under the backup account, uninstall the migrate-controller add-on and then reinstall it with the backup account. For more information, see Considerations.

Important

Disconnecting the backup cluster releases only the cluster registration. The following resources created by this procedure keep incurring charges until you release them:

  • The backup vault in the restore account and the associated cnfs-oss-* OSS bucket, which store the backup files.

  • The ECS snapshots created in the backup account, and the shared snapshot copies accepted in the restore account.

  • The cloud disks created in the restore account by the StorageClass conversion.

  • The Cloud Backup vault that stores the NAS volume data and, when enable_ecs_snapshot is false, the disk volume data.

  • The SLB instances that the Cloud Controller Manager creates for LoadBalancer Services during the restore.

Related documentation