This topic describes how to migrate services from a Container Service for Swarm cluster to a Container Service for Kubernetes (ACK) cluster and avoid service disruption with best efforts. Seven steps are required to complete the migration.

Migration scheme

Migration scheme

Procedure

  1. Standardize the Container Service for Swarm cluster.

    O&M engineers perform O&M operations in the Container Service for Swarm cluster to reduce migration costs and risks.

    1. Clients access applications in the Container Service for Swarm cluster through a Server Load Balancer (SLB) instance. This enables you to route a percentage of production traffic to the ACK cluster in real time.
      • If you access applications through an SLB instance, you can route a percentage of production traffic to the ACK cluster to verify that the migration is successful. This also allows you to roll back to Swarm when an error occurs. Changes in the SLB console take effect immediately.
      • If you use other methods to access applications, it may take 0 to 48 hours to update the client configurations or roll back DNS records. This poses negative impacts on your services.
    2. Deploy Cloud Monitor in the Container Service for Swarm cluster to monitor the Elastic Compute Service (ECS) instances running in the cluster and make sure that traffic is routed to the ACK cluster.
  2. Configure clusters for migration.

    O&M engineers create an ACK cluster and configure cluster resources. This reduces the workloads of developers during the migration process.

    1. Migrate servers and network resources.
    2. Migrate node tags.
    3. Verify the connectivity to the virtual private cloud (VPC) where the cluster is deployed.
    4. Migrate volumes.
    5. Migrate configurations.
  3. Migrate application configurations.

    Developers use Kompose to migrate application configurations to the ACK cluster.

    1. Set up an environment to complete the migration task.
    2. Preprocess Swarm Compose files.
    3. Convert the Swarm Compose files to Kubernetes resource files.
    4. Deploy the Kubernetes resource files.
    5. Manually migrate application configurations.
    6. Debug application startup.
    7. Migrate logging configurations of applications.
  4. Perform regression testing for the migrated applications.

    Test engineers perform regression testing to validate the functions of the migrated applications without affecting the application performance.

    1. Configure test domain names for the applications.
    2. Test application functions.
    3. Verify that application log data can be collected.
    4. Verify that the applications are monitored.
  5. Route traffic destined for the Container Service for Swarm cluster to the ACK cluster.

    O&M engineers route traffic to the ACK cluster through canary releases. They can roll back to the Container Service for Swarm cluster when an error occurs.

    1. Route traffic to the NodePort service.
    2. Roll back to the Container Service for Swarm cluster if necessary.
  6. Switch all production traffic to the ACK cluster.

    O&M engineers switch all production traffic to the ACK cluster by changing DNS settings or upgrading clients.

    1. Update DNS records to switch traffic.
    2. Upgrade client code or configurations to switch traffic.
  7. Delete the Container Service for Swarm cluster.

    After O&M engineers verify that traffic is routed to the ACK cluster, delete the Container Service for Swarm cluster.

    1. Verify that no traffic is routed to the Container Service for Swarm cluster.
    2. Delete the Container Service for Swarm cluster and release its resources.