All Products
Search
Document Center

Container Service for Kubernetes:Migrate applications from a self-managed Kubernetes cluster to an ACK cluster

Last Updated:May 18, 2026

You can use the backup center to back up applications and data deployed in an ACK One registered cluster and restore them to an online ACK cluster to quickly migrate offline applications to an online environment. This topic describes how to use the backup center to migrate applications from an offline cluster that is connected to an ACK One registered cluster to an online ACK cluster.

Prerequisites

  • An ACK One registered cluster is created and connected to a local data center cluster. The self-managed Kubernetes cluster must be version 1.16 or later.

  • An ACK managed cluster is created to serve as the restore cluster. The restore cluster must be in the same region as the registered cluster. Kubernetes 1.18 or later is recommended.

    Important
    • The 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.

  • Ensure that both the ACK One registered cluster and the ACK cluster have the backup service component installed and permissions configured.

  • For an ACK One registered cluster that is connected to a Virtual Private Cloud (VPC) through Cloud Enterprise Network (CEN), Express Connect, or a VPN gateway, ensure that you have configured a route to the internal endpoint of Object Storage Service (OSS). For more information, see Access OSS over internal endpoints and bucket domain names.

  • The Cloud Backup service is activated.

Scenarios

Cloud backup and disaster recovery: an integrated solution for backup, disaster recovery, and migration that helps you quickly migrate applications to the cloud and implement data disaster recovery. For more information, see Overview of registered clusters.

Notes

  • When you back up data from an external cluster, you must mount a local volume as a PV and a PVC. The Alibaba Cloud CSI plugin supports mounting volumes on an ACK One registered cluster. For more information, see Local volumes.

  • The ACK One registered cluster, ACK cluster, and OSS bucket must be in the same region.

Preparations

This topic uses a MySQL application as an example to describe how to deploy and back up the application in an external cluster, and then restore it to an ACK cluster. Before migrating the application, make sure that the ACK One registered cluster and the ACK cluster are in the same region, the cluster backup feature is enabled for both clusters, and the following requirements are met:

  • For the ACK One registered cluster: Create a RAM user and grant it permissions on OSS and Cloud Backup. Then, use the AccessKey ID and AccessKey secret of the RAM user to create a Secret named alibaba-addon-secret in the csdr namespace of the ACK One registered cluster.

    Run the following command to check whether the alibaba-addon-secret Secret exists.

    kubectl get secret alibaba-addon-secret -n csdr

    Expected output:

    alibaba-addon-secret   Opaque   2      5d22h
  • For the ACK cluster:

Step 1: Deploy the application in the external cluster

  1. Run the following command to create the test1 namespace:

    kubectl create namespace test1
  2. On a node that you want to back up, run the following command to create a mount path:

    mkdir /mnt/disk
  3. Create a file named app-mysql.yaml with the following content. Replace <YOUR-HOSTNAME> with the name of the node that you want to back up. Replace the values of username and password with the Base64-encoded username and password of the MySQL application.

    apiVersion: apps/v1
    kind: StatefulSet
    metadata:
      name: mysql-sts
      namespace: test1
    spec:
      selector:
        matchLabels:
          app: mysql-sts
      serviceName: mysql-sts
      template:
        metadata:
          labels:
            app: mysql-sts
        spec:
          containers:
          - name: mysql-sts
            image: registry.cn-hangzhou.aliyuncs.com/arms-docker-repo/arms-demo-mysql:v0.1
            env:
            - name: MYSQL_ROOT_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: mysql-pass
                  key: password
            ports:
            - containerPort: 3306
              name: mysql-sts
            volumeMounts:
            - name: mysql
              mountPath: /var/lib/mysql
          volumes:
            - name: mysql
              persistentVolumeClaim:
                claimName: example-pvc
    ---
    apiVersion: v1
    kind: PersistentVolume
    metadata:
      name: example-pv
    spec:
      capacity:
        storage: 100Gi
      volumeMode: Filesystem
      accessModes:
      - ReadWriteOnce
      persistentVolumeReclaimPolicy: Delete
      storageClassName: local-storage
      local:
        path: /mnt/disk
      nodeAffinity:
        required:
          nodeSelectorTerms:
          - matchExpressions:
            - key: kubernetes.io/hostname
              operator: In
              values:
              - <YOUR-HOSTNAME> # The name of the node to back up.
    ---
    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: example-pvc
      namespace: test1
    spec:
      accessModes:
      - ReadWriteOnce
      resources:
        requests:
          storage: 25Gi
      storageClassName: local-storage
      volumeName: example-pv
    ---
    apiVersion: v1
    kind: Secret
    metadata:
      name: mysql-pass
      namespace: test1
    type: Opaque
    data:
      username: dGVz****             # The Base64-encoded username of the MySQL application to be backed up. Replace the value with the actual username.
      password: dGVzdDEt****     # The Base64-encoded password of the MySQL application to be backed up. Replace the value with the actual password.
  4. Run the following command to deploy the MySQL application, mount the local disk as a PV, and create the related PV and PVC:

    kubectl create -f app-mysql.yaml

    Expected output:

    statefulset.apps/mysql-sts created
    persistentvolume/example-pv created
    persistentvolumeclaim/example-pvc created
    secret/mysql-pass created
  5. Run the following command to check whether the MySQL application is deployed:

    kubectl get pod -n test1 | grep mysql-sts

    Expected output:

    mysql-sts-0   1/1     Running   1 (4m51s ago)   4m58s

Step 2: Back up the application and data

The external cluster is connected to the ACK One registered cluster. You can perform backup tasks in the ACK One registered cluster.

  1. Create a backup vault in the ACK One registered cluster. For more information, see Create a backup vault.

  2. Create an instant backup named mysql in the ACK One registered cluster. For more information, see Create a backup plan or an instant backup.

    Set Name to mysql. For Backup Vaults, select the vault from the previous step. For Backup Namespaces, select test1.

  3. On the Application Backup page, click the Backup Records tab to view the status of the mysql-backup task. When the status changes from InProgress to Completed, the backup is complete.

Step 3: Restore the application in the ACK cluster

This section shows how to restore the MySQL application in the ACK cluster and convert its storage to the alibabacloud-cnfs-nas StorageClass. Perform the following steps:

  1. Create a restore task named mysql-restore to deploy the MySQL application to the test2 namespace of the ACK cluster and convert the StorageClass to alibabacloud-cnfs-nas. For more information, see Restore applications and data volumes.

    Parameter

    Value

    Name

    mysql-restore

    Backup Vaults

    Select the backup vault that you created. If the Initialize Backup Vault button appears, click it and wait for the backup records to synchronize to the cluster.

    Select Backup

    mysql

    Reset Namespace

    Remap the namespace from test1 to test2.

    StorageClass Conversion

    In the list of PVCs to be converted, select the alibabacloud-cnfs-nas StorageClass for example-pvc.

  2. To the right of Restore, click View Restoration Records. The restoration is complete when the task status changes from InProgress to Completed.

  3. Run the following command in the ACK cluster to verify that the MySQL application is deployed:

    kubectl get pod -n test2 | grep mysql-sts

    Expected output:

    mysql-sts-0   1/1     Running   0          4s
  4. Run the following commands in the ACK cluster to verify that the data is restored:

    1. Verify that the data is restored to the alibabacloud-cnfs-nas StorageClass.

      kubectl get pvc -n test2 | grep example-pvc

      Expected output:

      example-pvc   Bound    nas-acde4acd-59b6-4332-90af-b74ef6******   25Gi       RWO            alibabacloud-cnfs-nas   31m
    2. Verify that example-pvc is mounted to the MySQL application.

      kubectl describe pvc example-pvc -n test2 | grep "Used By"

      Expected output:

      Used By:       mysql-sts-0