From 12ab48b2c9998e01c68fdaf5f3ad090cb2a0a757 Mon Sep 17 00:00:00 2001 From: Wilson Wu Date: Mon, 25 Nov 2024 11:12:53 +0800 Subject: [PATCH] Sync multicluster multi-primary multi network doc updates into Chinese (#15984) --- .../multi-primary_multi-network/index.md | 175 ++++++++++++++++-- 1 file changed, 163 insertions(+), 12 deletions(-) diff --git a/content/zh/docs/setup/install/multicluster/multi-primary_multi-network/index.md b/content/zh/docs/setup/install/multicluster/multi-primary_multi-network/index.md index aad61adf4c..b12e2c5ea1 100644 --- a/content/zh/docs/setup/install/multicluster/multi-primary_multi-network/index.md +++ b/content/zh/docs/setup/install/multicluster/multi-primary_multi-network/index.md @@ -38,7 +38,13 @@ $ kubectl --context="${CTX_CLUSTER1}" get namespace istio-system && \ ## 将 `cluster1` 设为主集群 {#configure-cluster1-as-a-primary} -为 `cluster1` 创建 Istio 配置文件: +为 `cluster1` 创建 `istioctl` 配置: + +{{< tabset category-name="multicluster-install-type-cluster-1" >}} + +{{< tab name="IstioOperator" category-value="iop" >}} + +使用 istioctl 和 `IstioOperator` API 在 `cluster1` 中将 Istio 安装为主节点。 {{< text bash >}} $ cat < cluster1.yaml @@ -60,6 +66,27 @@ EOF $ istioctl install --context="${CTX_CLUSTER1}" -f cluster1.yaml {{< /text >}} +{{< /tab >}} +{{< tab name="Helm" category-value="helm" >}} + +使用以下 Helm 命令在 `cluster1` 中将 Istio 安装为主节点: + +在 `cluster1` 中安装 `base` Chart: + +{{< text bash >}} +$ helm install istio-base istio/base -n istio-system --kube-context "${CTX_CLUSTER1}" +{{< /text >}} + +然后,使用以下多集群设置在 `cluster1` 中安装 `istiod` Chart: + +{{< text bash >}} +$ helm install istiod istio/istiod -n istio-system --kube-context "${CTX_CLUSTER1}" --set global.meshID=mesh1 --set global.multiCluster.clusterName=cluster1 --set global.network=network1 +{{< /text >}} + +{{< /tab >}} + +{{< /tabset >}} + ## 在 `cluster1` 安装东西向网关 {#install-the-east-west-gateway-in-cluster1} 在 `cluster1` 安装专用的 @@ -68,6 +95,10 @@ $ istioctl install --context="${CTX_CLUSTER1}" -f cluster1.yaml 生产系统可能需要添加额外的访问限制(即:通过防火墙规则)来防止外部攻击。 咨询您的云服务商,了解可用的选择。 +{{< tabset category-name="east-west-gateway-install-type-cluster-1" >}} + +{{< tab name="IstioOperator" category-value="iop" >}} + {{< text bash >}} $ @samples/multicluster/gen-eastwest-gateway.sh@ \ --network network1 | \ @@ -79,6 +110,24 @@ $ @samples/multicluster/gen-eastwest-gateway.sh@ \ `--revision rev` 标志。 {{< /warning >}} +{{< /tab >}} +{{< tab name="Helm" category-value="helm" >}} + +使用以下 Helm 命令在 `cluster1` 中安装东西网关: + +{{< text bash >}} +$ helm install istio-eastwestgateway istio/gateway -n istio-system --kube-context "${CTX_CLUSTER1}" --set name=istio-eastwestgateway --set networkGateway=network1 +{{< /text >}} + +{{< warning >}} +如果控制平面是使用修订版安装的,则必须在 Helm 安装命令中添加 +`--set revision=` 标志。 +{{< /warning >}} + +{{< /tab >}} + +{{< /tabset >}} + 等待东西向网关被分配外部 IP 地址: {{< text bash >}} @@ -109,7 +158,13 @@ $ kubectl --context="${CTX_CLUSTER2}" get namespace istio-system && \ ## 将 cluster2 设为主集群 {#configure-cluster2-as-a-primary} -为 `cluster2` 创建 Istio 配置文件: +为 `cluster2` 创建 `istioctl` 配置: + +{{< tabset category-name="multicluster-install-type-cluster-2" >}} + +{{< tab name="IstioOperator" category-value="iop" >}} + +使用 istioctl 和 `IstioOperator` API 在 `cluster2` 中将 Istio 安装为主节点。 {{< text bash >}} $ cat < cluster2.yaml @@ -131,16 +186,59 @@ EOF $ istioctl install --context="${CTX_CLUSTER2}" -f cluster2.yaml {{< /text >}} +{{< /tab >}} +{{< tab name="Helm" category-value="helm" >}} + +使用以下 Helm 命令在 `cluster2` 中将 Istio 安装为主节点: + +在 `cluster2` 中安装 `base` Chart: + +{{< text bash >}} +$ helm install istio-base istio/base -n istio-system --kube-context "${CTX_CLUSTER2}" +{{< /text >}} + +然后,使用以下多集群设置在 `cluster2` 中安装 `istiod` Chart: + +{{< text bash >}} +$ helm install istiod istio/istiod -n istio-system --kube-context "${CTX_CLUSTER2}" --set global.meshID=mesh1 --set global.multiCluster.clusterName=cluster2 --set global.network=network2 +{{< /text >}} + +{{< /tab >}} + +{{< /tabset >}} + ## 在 `cluster2` 安装东西向网关 {#install-the-east-west-gateway-in-cluster2} 仿照上面 `cluster1` 的操作,在 `cluster2` 安装专用于东西向流量的网关。 +{{< tabset category-name="east-west-gateway-install-type-cluster-2" >}} + +{{< tab name="IstioOperator" category-value="iop" >}} + {{< text bash >}} $ @samples/multicluster/gen-eastwest-gateway.sh@ \ --network network2 | \ istioctl --context="${CTX_CLUSTER2}" install -y -f - {{< /text >}} +{{< /tab >}} +{{< tab name="Helm" category-value="helm" >}} + +使用以下 Helm 命令在 `cluster2` 中安装东西网关: + +{{< text bash >}} +$ helm install istio-eastwestgateway istio/gateway -n istio-system --kube-context "${CTX_CLUSTER2}" --set name=istio-eastwestgateway --set networkGateway=network2 +{{< /text >}} + +{{< warning >}} +如果控制平面是使用修订版安装的,则必须在 Helm 安装命令中添加 +`--set revision=` 标志。 +{{< /warning >}} + +{{< /tab >}} + +{{< /tabset >}} + 等待东西向网关被分配外部 IP 地址: {{< text bash >}} @@ -186,16 +284,69 @@ $ istioctl create-remote-secret \ ## 清理 {#cleanup} -1. 卸载 `cluster1` 中的 Istio: +使用与安装 Istio 相同的机制(istioctl 或 Helm)从 +`cluster1` 和 `cluster2` 中卸载 Istio。 - {{< text syntax=bash snip_id=none >}} - $ istioctl uninstall --context="${CTX_CLUSTER1}" -y --purge - $ kubectl delete ns istio-system --context="${CTX_CLUSTER1}" - {{< /text >}} +{{< tabset category-name="multicluster-uninstall-type-cluster-1" >}} -1. 卸载 `cluster2` 中的 Istio: +{{< tab name="IstioOperator" category-value="iop" >}} - {{< text syntax=bash snip_id=none >}} - $ istioctl uninstall --context="${CTX_CLUSTER2}" -y --purge - $ kubectl delete ns istio-system --context="${CTX_CLUSTER2}" - {{< /text >}} +在 `cluster1` 中卸载 Istio: + +{{< text syntax=bash snip_id=none >}} +$ istioctl uninstall --context="${CTX_CLUSTER1}" -y --purge +$ kubectl delete ns istio-system --context="${CTX_CLUSTER1}" +{{< /text >}} + +在 `cluster2` 中卸载 Istio: + +{{< text syntax=bash snip_id=none >}} +$ istioctl uninstall --context="${CTX_CLUSTER2}" -y --purge +$ kubectl delete ns istio-system --context="${CTX_CLUSTER2}" +{{< /text >}} + +{{< /tab >}} + +{{< tab name="Helm" category-value="helm" >}} + +从 `cluster1` 中删除 Istio Helm 安装: + +{{< text syntax=bash >}} +$ helm delete istiod -n istio-system --kube-context "${CTX_CLUSTER1}" +$ helm delete istio-eastwestgateway -n istio-system --kube-context "${CTX_CLUSTER1}" +$ helm delete istio-base -n istio-system --kube-context "${CTX_CLUSTER1}" +{{< /text >}} + +从 `cluster1` 中删除 `istio-system` 命名空间: + +{{< text syntax=bash >}} +$ kubectl delete ns istio-system --context="${CTX_CLUSTER1}" +{{< /text >}} + +从 `cluster2` 中删除 Istio Helm 安装: + +{{< text syntax=bash >}} +$ helm delete istiod -n istio-system --kube-context "${CTX_CLUSTER2}" +$ helm delete istio-eastwestgateway -n istio-system --kube-context "${CTX_CLUSTER2}" +$ helm delete istio-base -n istio-system --kube-context "${CTX_CLUSTER2}" +{{< /text >}} + +从 `cluster2` 中删除 `istio-system` 命名空间: + +{{< text syntax=bash >}} +$ kubectl delete ns istio-system --context="${CTX_CLUSTER2}" +{{< /text >}} + +(可选)删除 Istio 安装的 CRD: + +删除 CRD 会永久删除您在集群中创建的所有 Istio 资源。 +要删除集群中安装的 Istio CRD,请执行以下操作: + +{{< text syntax=bash snip_id=delete_crds >}} +$ kubectl get crd -oname --context "${CTX_CLUSTER1}" | grep --color=never 'istio.io' | xargs kubectl delete --context "${CTX_CLUSTER1}" +$ kubectl get crd -oname --context "${CTX_CLUSTER2}" | grep --color=never 'istio.io' | xargs kubectl delete --context "${CTX_CLUSTER2}" +{{< /text >}} + +{{< /tab >}} + +{{< /tabset >}}