To improve the stability, performance, extensibility, and security of your Ingress gateway and to access more routing features, you can migrate your services from a CLB Ingress to an ALB Ingress. This topic describes a migration method that prevents traffic loss and service interruptions.
1. Create an ALB Ingress
Go to SAE Gateway Routes. At the top of the page, select the destination region and namespace, and then click Create Gateway Route. Make sure that the selected region and namespace are the same as those of the original CLB Ingress.
Enter a custom Route Name.
Set Gateway Type to Application Load Balancer (ALB).
For ALB Instance, you can select an existing instance or create a new one.
Configure the remaining parameters according to the original CLB Ingress configuration: Network Type, Frontend Protocol Type (if you select HTTPS, you must also configure an SSL Certificate), Access Port, Custom Forwarding Rule (including Domain Name, Path, Backend Application, Container Port, and Rewrite Policy), and Default Forwarding Rule.
Click Save. Wait for the ALB Ingress to be created.
Click the Gateway Instance of the ALB Ingress to open the ALB instance details page. On the Instance Details tab, obtain the DNS Name from the Basic Information section and all Elastic IP Addresses from the Zones section for later use.
In the Actions column of the ALB Ingress, click Edit. Obtain the Frontend Protocol Type, Access Port, and Path for each custom forwarding rule. You will need this information later.
Verify the ALB Ingress (only for public ALB Ingresses):
Modify the local hosts file to resolve the domain name of the custom forwarding rule to an Elastic IP Address (EIP) of the ALB instance:
Windows
Add the following content to the end of the
C:\Windows\System32\drivers\etc\hostsfile and save the file. Replace<public_ip>with any EIP of the ALB instance and<domain_name>with the domain name of the custom forwarding rule.<public_ip> <domain_name>Verify that the hosts file configuration is effective. Run the following command on the command line and replace
<domain_name>with the domain name of the custom forwarding rule. If the returned result contains an EIP of the ALB instance, the configuration is effective. If not, restart your system and try again.ping <domain_name>
macOS/Linux
Add the following content to the end of the
/etc/hostsfile and save the file. Replace<public_ip>with any EIP of the ALB instance and<domain_name>with the domain name of the custom forwarding rule.<public_ip> <domain_name>Verify that the hosts file configuration is effective. Run the following command on the command line and replace
<domain_name>with the domain name of the custom forwarding rule. If the returned result contains an EIP of the ALB instance, the configuration is effective. If not, restart your system and try again.ping <domain_name>
In a browser, access the URL for each custom forwarding rule to verify the configuration. The URL format is
<Frontend Protocol Type>://<Domain Name>:<Access Port><Path>. For example,http://xx.xx.xx:80/test.
2. Configure DNS resolution
This topic provides an example of using Alibaba Cloud DNS for authoritative DNS resolution. Go to Authoritative DNS, and in the Actions column for the destination domain name, click Configure.
On the Configure tab, find the DNS record for the original CLB Ingress. In the Actions column, choose . In the Record Value Set section, click Add Entry and set Record Value to an EIP of the ALB instance. If the ALB instance has multiple EIPs, click Add Entry for each additional EIP.
Configure the weights: Set Record Value Load Policy to Weight. For example, if the ALB instance has two EIPs, set the Weight for both EIP records to
1. Change the Weight of the original CLB instance record to98. This configuration allocates1/100of the DNS resolution traffic to each EIP of the ALB instance, leaving most of the traffic unchanged for now.Click OK and wait for the DNS record to take effect.
Switch DNS resolution traffic to the EIPs of the ALB instance: Monitor the running status and traffic of your services. If no issues occur, gradually decrease the record Weight for the CLB instance EIP and increase the record Weight for the ALB instance EIPs. Ensure that the record Weight is the same for all ALB instance EIPs. After all traffic is switched to the ALB instance, delete the record for the original CLB instance.
Switch DNS resolution traffic to the ALB instance's DNS name: Retain the DNS record for only one EIP of the ALB instance and delete the others. In the Actions column for the remaining record, click Modify. Set Record Type to CNAME and Record Value to the DNS Name of the ALB instance. Click OK and wait for the DNS record to take effect.
3. Delete the original CLB instance and CLB Ingress
Go to SAE Gateway Routes. At the top of the page, select the destination region and namespace. Click the Gateway Instance of the target gateway route to open the instance details page. In the upper-right corner, choose and follow the on-screen instructions to release the CLB instance.
Go to SAE Gateway Routes. At the top of the page, select the destination region and namespace. In the Actions column of the target gateway route, click Delete. Follow the on-screen instructions to delete the CLB Ingress.