This topic describes how to switch all production traffic to a Kubernetes cluster after you have validated the functions of the cluster using canary releases. You can modify DNS records or upgrade client versions to switch traffic.

Prerequisites

To lower the risk of service disruption, make sure that the services running in the Kubernetes cluster are normal before you switch all production traffic to the cluster. You can perform regression testing to validate the functions of the services based on their testing domain or production domain. For more information, see Regression testing.

Modify DNS records to switch traffic

If your clients connect to Kubernetes services through a production domain, you can modify DNS records to switch production traffic to the Kubernetes cluster without service disruption.

  1. Obtain the public IP address of the SLB instance attached to the Kubernetes cluster. In this example, the IP address is 39.XX.XX.112.
    Log on to the Container Service console. In the left-side navigation pane, choose Ingresses and Load Balancing > Ingresses. On the Ingresses page, select cluster k8s-piggymetrics-cluster and namespace default. Find the target Ingress and its endpoint is 39.XX.XX.112, which is the public IP address of the SLB instance attached to the cluster.
  2. Add the public IP address 39.XX.XX.112 to the backend of production domain piggymetrics.com at your DNS provider. This points the production domain to the public IP address of the SLB instance.
  3. Monitor the service performance and check whether traffic sent to the Kubernetes cluster is properly handled. For more information, see Regression testing.
    Note You can also use your own monitoring system to check whether the services in the Kubernetes cluster are running normally.
  4. After you make sure that traffic sent to the Kubernetes cluster is properly handled, remove the public IP of the SLB instance attached to the Swarm cluster from the backend of the production domain at your DNS provider.

    In this example, the public IP address of the SLB instance attached to the Swarm cluster is 39.XX.XX.230. Remove this IP address from the backend of production domain piggymetrics.com.

Upgrade client versions to switch traffic

If your clients use the host IP to access the public IP of the SLB instance attached to the Swarm cluster, you need to stop Swarm services to switch traffic to Kubernetes services. If your clients connect to Swarm services through a testing domain, you need to change the domain because the Swarm cluster and Kubernetes cluster use different testing domains. We recommend that you perform the switchover during off-peak hours.

  1. Obtain the public IP address of the SLB instance attached to the Kubernetes cluster. In this example, the IP address is 39.XX.XX.112.
    Log on to the Container Service console. In the left-side navigation pane, choose Ingresses and Load Balancing > Ingresses. On the Ingresses page, select cluster k8s-piggymetrics-cluster and namespace default. Find the target Ingress and its endpoint is 39.XX.XX.112, which is the public IP address of the SLB instance attached to the cluster.
  2. Upgrade client versions or change configurations to add 39.XX.XX.112 to the list of target servers.
  3. Monitor the service performance and check whether traffic sent to the Kubernetes cluster is properly handled. For more information, see Regression testing.
    Note You can also use your own monitoring system to check whether the services in the Kubernetes cluster are running normally.
  4. After you make sure that traffic sent to the Kubernetes cluster is properly handled, upgrade client versions or change configurations to remove the public IP of the SLB instance attached to the Swarm cluster from the list of target servers.

    In this example, the public IP address of the SLB instance attached to the Swarm cluster is 39.XX.XX.230. Remove this IP address from the list of target servers in the client configurations.