这些步骤适用于 Knative serving“GKE 插件”默认包含的捆绑版 Istio。
由于在执行卸载 Knative serving“GKE 插件”的过程时卸载了捆绑版 Istio,因此本页面中的步骤会在集群上安装 Cloud Service Mesh,然后配置入站流量网关。
准备工作
概览
整体而言,从捆绑版 Istio 迁移时安装 Cloud Service Mesh 的过程与执行 Cloud Service Mesh 全新安装的过程相同。在此过程中,Cloud Service Mesh 版本 1.19 随 集群内控制平面一起安装。
安装 Cloud Service Mesh
您可以按照 Cloud Service Mesh 安装文档安装 Cloud Service Mesh。
准备工作:
对于迁移,必须在后续配置步骤中单独安装入站流量网关。默认情况下,安装脚本不会安装入站流量网关。
可选:如果您使用 Cloud Service Mesh 证书授权机构 (Mesh CA),还必须在 Cloud Service Mesh 安装脚本中添加
--ca mesh_ca标志。
安装 Cloud Service Mesh:
按照 Cloud Service Mesh 文档中的步骤操作: 安装 Cloud Service Mesh
- 示例
以下是包含必需标志的默认命令的示例:
./asmcli install \ --project_id ${PROJECT_ID} \ --cluster_name ${CLUSTER_NAME} \ --cluster_location ${CLUSTER_LOCATION} \ --ca mesh_ca \ --output_dir DIR_PATH \ --enable_all
配置 Cloud Service Mesh Ingress
在本部分中,迁移脚本用于在 gke-system 命名空间内创建 Cloud Service Mesh 入站流量网关。
对于迁移,将使用 gke-system 命名空间,以便在刚刚移除的“捆绑的 Istio”使用的同一命名空间中创建入站流量网关。这样,Cloud Service Mesh Ingress pod 便可以无缝接管流量,而无需对入站流量服务进行任何配置更改。例如,您无需配置新的外部 IP 地址。
要在
gke-system命名空间中创建入站流量网关,请运行以下命令启动迁移脚本:./migration-addon.sh --command set-up-asm-ingress该过程中的终端输出类似于以下内容:
Setting up Cloud Service Mesh ingress. Note that the Cloud Service Mesh ingress is not serving traffic at this step. namespace/gke-system labeled deployment.apps/istio-ingressgateway created horizontalpodautoscaler.autoscaling/istio-ingressgateway created role.rbac.authorization.k8s.io/istio-ingressgateway-sds created rolebinding.rbac.authorization.k8s.io/istio-ingressgateway-sds created Cloud Service Mesh ingress is successfully installed.通过运行以下命令验证
istio-ingrerssgateway入站流量网关正在gke-system命名空间中运行:kubectl get deployment istio-ingressgateway -n gke-system请注意,
istio-ingressgatewaypod 的数量是特意设置为0。安装 Knative serving 舰队组件后,您需要执行后续步骤将所有流量迁移到 Cloud Service Mesh Ingress。
后续步骤
回滚
如果您需要回滚通过上述步骤所做的更改,则可以使用迁移脚本执行以下操作:
- 删除 Cloud Service Mesh 入站流量网关。
- 卸载 Cloud Service Mesh。
如需回滚 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.如需确认 Cloud Service Mesh 入站流量网关已移除,请验证
gke-system命名空间中不再存在istio-ingressgateway服务:kubectl get deployment istio-ingressgateway -n gke-system如需继续将所有更改回滚至安装原始状态,请回滚 Knative serving“GKE 插件”。