Este tópico descreve como migrar um gateway de entrada Istio autogerenciado para um gateway de entrada ASM.
Solução de migração

Etapa 1: Tornar reutilizável a instância CLB criada pelo gateway de entrada Istio
Se um service criou automaticamente a instância CLB usada pelo gateway de entrada Istio, ela não será reutilizável por padrão. Para distribuir o tráfego entre os gateways de entrada Istio e ASM em uma proporção especificada via instância CLB durante a migração, torne essa instância reutilizável.
Faça login no console CLB e localize a instância CLB de destino. Clique em ID da instância para acessar a página de configuração.
Desative a proteção contra modificação da instância.
Remova as duas tags a seguir da instância CLB:
kubernetes.do.not.deleteeack.aliyun.com.Adicione as anotações abaixo ao service do gateway de entrada Istio:
# If this annotation is set to false, port changes of the Service do not affect the listeners of the CLB instance.
service.beta.kubernetes.io/alibaba-cloud-loadbalancer-force-override-listeners: "false"
service.beta.kubernetes.io/alibaba-cloud-loadbalancer-id: <CLB_INSTANCE_ID>
service.beta.kubernetes.io/alibaba-cloud-loadbalancer-vgroup-port: <VSERVER_GROUP_ID>:<PORT>,<VSERVER_GROUP_ID>:<PORT>...
service.beta.kubernetes.io/alibaba-cloud-loadbalancer-weight: "100"
Exemplo:
service.beta.kubernetes.io/alibaba-cloud-loadbalancer-force-override-listeners: "false"
service.beta.kubernetes.io/alibaba-cloud-loadbalancer-id: lb-bp1onpskfeceg********
# You can obtain the vServer group information from the CLB console. Enter the instance and click the vServer Group tab.
# You must list all vServer groups of the CLB instance in the following annotation, in the format of <VSERVER_GROUP_ID>:<PORT>.
# Separate multiple values with commas (,).
service.beta.kubernetes.io/alibaba-cloud-loadbalancer-vgroup-port: rsp-bp1r4xk******:15021,rsp-bp1kaqd******:80,rsp-bp1jyz0******:443
# Before the migration starts, the weight of the Istio ingress gateway is 100, and all traffic goes through the Istio ingress gateway.
service.beta.kubernetes.io/alibaba-cloud-loadbalancer-weight: "100"
Etapa 2: Criar um gateway de entrada na instância ASM
Para obter mais informações sobre como criar um gateway de entrada, consulte Create an ingress gateway.
Ao criar o gateway de entrada, observe os pontos a seguir:
-
Crie o gateway ASM usando um arquivo YAML. Para mais detalhes, consulte CRD fields for an ASM gateway.
Ao nomear o gateway ASM, garanta que o nome não duplique um gateway existente. Adicione o sufixo -asm ao nome para diferenciá-lo dos gateways atuais, por exemplo, ingressgateway-asm.
Certifique-se de que a lista de portas e o targetPort do gateway ASM sejam idênticos aos do gateway de entrada Istio.
-
Consulte o item (4) em Step 1: Make the CLB instance created by the Istio ingress gateway reusable e crie o gateway ASM utilizando um CRD. Para mais informações, consulte CRD fields. Para reutilizar a instância CLB do gateway de entrada Istio e implementar a troca de tráfego baseada em CLB, configure o serviceAnnotation do gateway ASM da seguinte forma:
# If this annotation is set to true, ACK uses the ports of the Service of the ASM gateway to update the listeners of the CLB instance. # To ensure service continuity, make sure that the ports exposed by the ASM gateway are the same as those of the Istio ingress gateway. # If traffic exceptions occur after the ASM gateway is created, change this annotation on the ASM gateway to false and change this annotation on the Istio ingress gateway to true to restore the listener configurations. service.beta.kubernetes.io/alibaba-cloud-loadbalancer-force-override-listeners: "true" service.beta.kubernetes.io/alibaba-cloud-loadbalancer-id: lb-bp1onpskfeceg******** # You can obtain the vServer group information from the CLB console. Enter the instance and click the vServer Group tab. # You must list all vServer groups of the CLB instance in the following annotation, in the format of <VSERVER_GROUP_ID>:<PORT>. # Separate multiple values with commas (,). service.beta.kubernetes.io/alibaba-cloud-loadbalancer-vgroup-port: rsp-bp1r4xk******:15021,rsp-bp1kaqd******:80,rsp-bp1jyz0******:443 # Before the migration starts, the weight of the Istio ingress gateway is 100, and all traffic goes through the Istio ingress gateway. The weight of the ASM gateway is 0. service.beta.kubernetes.io/alibaba-cloud-loadbalancer-weight: "0"
Verifique a reutilização do CLB: faça login no console CLB, selecione um grupo vServer e clique em nome do grupo para visualizar os servidores de back-end. Se tanto o endereço IP do pod do gateway de entrada Istio quanto o do gateway ASM aparecerem na lista, esta etapa foi concluída com sucesso.
Etapa 3: Migrar configurações relacionadas ao gateway para o ASM
Para que o gateway ASM se comporte da mesma forma que o gateway de entrada Istio, aplique as configurações relacionadas ao gateway do Istio no ASM.
-
O gateway ASM não pode ter o mesmo nome do gateway de entrada Istio. Ao migrar o Gateway CR, altere o campo
spec.selector.istiopara o nome real do gateway ASM. O YAML abaixo fornece um exemplo:spec: selector: istio: ingressgateway-asm Os VirtualService CRs e DestinationRule CRs não precisam de modificação. Migre-os diretamente.
Etapa 4: Migrar gradualmente o tráfego para o gateway ASM
Modifique separadamente os serviceAnnotations dos gateways de entrada Istio e ASM para alternar seus pesos. Aumente progressivamente a proporção de tráfego do gateway ASM enquanto reduz a do gateway de entrada Istio até transferir todo o tráfego para o gateway ASM e concluir a migração.
Modifique as anotações de service do gateway de entrada Istio e do gateway ASM para controlar a proporção de tráfego encaminhado pela instância CLB:
Altere o peso do gateway de entrada Istio original: adicione uma anotação ao service correspondente, por exemplo,
service.beta.kubernetes.io/alibaba-cloud-loadbalancer-weight: "90".Ajuste o peso da instância do gateway ASM: adicione serviceAnnotations ao recurso IstioGateway correspondente, como
service.beta.kubernetes.io/alibaba-cloud-loadbalancer-weight: "10".