This topic describes how to route a percentage of production traffic to a Container Service for Kubernetes (ACK) cluster to verify the cluster functions that are not included in regression testing.

Prerequisites

The regression testing is completed. For more information, see Regression testing.

Route traffic to the NodePort service

You can use a Server Load Balancer (SLB) instance attached to a Container Service for Swarm cluster or an SLB instance attached to an ACK cluster to route traffic in the following ways:
  • Route traffic by using an SLB instance attached to an ACK cluster: Add the endpoint of the SLB instance to the client or Domain Name System (DNS) record. This requires you to update the client configurations or modify the DNS settings.
    • High cost of traffic redirection

      You must update the client configurations or modify the DNS settings.

    • High risk of rollback
      • If issues are found in the ACK cluster, you must update the client configurations or modify the DNS settings again.
      • It may take a long time period to update the client configurations or cache the DNS settings. This poses negative impacts on the service performance.
  • Route traffic by using an SLB instance attached to a Container Service for Swarm cluster: Add your Kubernetes service to a VServer group of the SLB instance that is attached to the Container Service for Swarm cluster. Then, set weights to specify the percent of traffic to be routed to the service.
    • Low cost of traffic redirection
      • You only need to configure the SLB instance attached to the Container Service for Swarm cluster in the SLB console.
      • You can set weights to specify the percentage of traffic to be routed to different services in the SLB console.
    • Low risk of rollback
      • You only need to configure the SLB instance attached to the Container Service for Swarm cluster in the SLB console.
      • The new configurations immediately take effect.
  1. Create a NodePort service in an ACK cluster.
  2. Validate the functions of the NodePort service.
  3. Configure the SLB instance attached to the Swarm cluster.

How to roll back

After production traffic is routed to the Kubernetes service, you can modify the VServer group to which you add the Kubernetes service when issues are found. You can set the weight of the Elastic Compute Service (ECS) instance where the service runs to 0 or remove the ECS instance.

  1. Log on to the SLB console. On the Instances page, click the SLB instance that you want to manage.
  2. On the page that appears, click the VServer Groups tab. Select the VServer group to which you add the Kubernetes service and click Edit in the Actions column.
  3. On the Edit VServer Group page, find the ECS instance where the Kubernetes service runs, click Delete in the Actions column, and click OK.

Summary

You can configure VServer groups of an SLB instance that is attached to a Container Service for Swarm cluster to route a percentage of production traffic to the NodePort service deployed in an ACK cluster. After traffic is redirected, you can verify the functions of the service.

Compared with traffic redirection by updating the client configurations or modifying the DNS settings, this method only requires you to modify the SLB configurations in the SLB console. The configuration changes take effect immediately and you can specify the percentage of traffic to be sent to different services. You can also roll back when an error occurs. This reduces the cost of migration and minimizes the risk.