将工作负载流量迁移到 Cloud Service Mesh

流程中的这个步骤可让您选择如何发布更改。您可以指定要迁移到 Cloud Service Mesh 的初始流量,然后逐步将发布比例提高到 100%。

准备工作

将所有工作负载流量迁移到 Cloud Service Mesh

在本部分中,迁移脚本用于将您现有的所有流量迁移到 Cloud Service Mesh。

  1. 运行以下命令以设置要迁移的流量的百分比:

    ./migration-addon.sh --command migrate-traffic TRAFFIC_PERCENTAGE
    

    TRAFFIC_PERCENTAGE 替换为您要发送到 Cloud Service Mesh 入站流量的流量百分比。有效值包括:0102030405060708090100

    请注意,如果您在此步骤遇到任何问题或想要执行逐步发布,则可以多次重新运行此迁移脚本命令,直至达到 100%。

    例如,如果您选择迁移 10% 的流量,则该过程中的终端输出将如下所示:

    In this step, 10% of traffic from the previously installed
    version of Istio is migrated to the Cloud Service Mesh ingress.
    
    Setting the number of replicas of Istio ingress to 9,
    and the number of replicas of Cloud Service Mesh ingress to 1
    deployment.apps/istio-ingress patched
    
    Waiting for all istio-ingress pods to be ready
    
    All istio-ingress pods are ready.
    deployment.apps/istio-ingressgateway patched
    
    Waiting for all istio-ingressgateway pods to be ready
    
    All istio-ingressgateway pods are ready.
    
    10% traffic has been migrated to Cloud Service Mesh ingress
    
  2. 您可以在 Google Cloud Console 中监控服务的流量:

    前往 Knative 服务

后续步骤

完成升级并执行清理任务

回滚

如果您需要回滚通过上述步骤所做的更改,可以使用迁移脚本将流向 Cloud Service Mesh 入站流量的流量百分比设置回 0

./migration-addon.sh --command migrate-traffic 0