将 Istio 插件迁移到 Cloud Service Mesh

这些步骤适用于集群中配置了 Istio on GKE 的入站流量网关的安装。在此过程中,Cloud Service Mesh 1.18 版随代管式控制平面一起安装。

准备工作

概览

一般来说,使用代管式控制平面从 Istio 插件迁移到 Cloud Service Mesh 的过程包括:

  1. 安装 Cloud Service Mesh 代管式控制平面。
  2. 使用迁移脚本配置 Cloud Service Mesh 入站流量网关。

迁移到 Cloud Service Mesh 1.18 版

您必须按照 Cloud Service Mesh 文档“从 Istio on GKE 迁移到 Cloud Service Mesh”中的详细说明操作。完成安装并迁移工作负载后,请返回本页面完成剩余的配置步骤。

  1. 按照“Istio 插件迁移说明”操作,通过 Google 管理的控制平面将安装迁移到 Cloud Service Mesh。

    此过程中需要注意的关键事项包括:

    • 如果系统提示 custom envoy filters are not supported,只需选择“是”以继续迁移。示例:

      Detected custom envoy filters are not supported by Cloud Service Mesh.
      Please remove these if possible
      NAMESPACE    NAME                                 AGE
      gke-system   allowconnect-cluster-local-gateway   26m
      Continue anyways? [y/N] Y
      
    • 迁移说明包括完成成功迁移部分,该部分会执行步骤以完成 Cloud Service Mesh 安装。重要提示:执行这些步骤后,您将无法回滚更改。

    Istio 插件迁移说明从 Istio on GKE 迁移到 Cloud Service Mesh

  2. 完成迁移步骤并将工作负载迁移到 Cloud Service Mesh 后,请运行以下命令以重启 knative-serving 命名空间中的 Ingress Pod 并为其添加标签:

    1. 重启 Ingress pod:

      kubectl rollout restart deployment autoscaler activator webhook -n knative-serving
      
    2. 添加 istio: ingressgateway 标签:

      kubectl patch deployment ${INGRESS_NAME} --namespace ${INGRESS_NAMESPACE} --patch  '{"spec": {"template": {"metadata": {"labels": {"istio": "ingressgateway"}}}}}'
      

配置 Cloud Service Mesh Ingress

在本部分中,迁移脚本用于为 Cloud Service Mesh 代管式控制平面将发布渠道设置为 asm-managed-rapid

运行以下命令以启动迁移脚本:

 ./migration-addon.sh \
 --asm-revision asm-managed-rapid \
 --command set-up-asm-ingress

后续步骤

安装舰队组件

回滚

如果您需要回滚通过上述步骤所做的更改,则可以执行以下操作:

  • 使用迁移脚本删除 Cloud Service Mesh 入站流量。
  • 回滚 Cloud Service Mesh 的安装。

如需使用 Google 管理的控制平面回滚 Cloud Service Mesh 的安装和配置,请执行以下操作:

  1. 运行以下命令以删除 Cloud Service Mesh 入站流量:

    ./migration-addon.sh --command rollback-set-up-asm-ingress
    

    该过程中的终端输出类似于以下内容:

    Deleting Cloud Service Mesh ingress
    deployment.apps "istio-ingressgateway" deleted
    horizontalpodautoscaler.autoscaling "istio-ingressgateway" deleted
    role.rbac.authorization.k8s.io "istio-ingressgateway-sds" deleted
    rolebinding.rbac.authorization.k8s.io "istio-ingressgateway-sds" deleted
    Cloud Service Mesh ingress is successfully deleted.
    
  2. 如需验证回滚,请确认 gke-system 命名空间中不再存在 istio-ingressgateway 服务:

    kubectl get deployment istio-ingressgateway -n gke-system
    
  3. 回滚 Cloud Service Mesh 安装

  4. 运行以下命令重新启用“Istio 插件”:

    ./migration-addon.sh --command rollback-uninstall-istio-addon
    
  5. 如需继续将更改回滚到安装的原始状态,请回滚 Istio 插件