安装多主节点

按照本指南在 cluster1cluster2 上安装 Istio 控制平面,使每个集群成为 主集群。 两个集群都位于 network1 网络中,这意味着两个集群中的 Pod 之间存在直接连接。

在继续之前,请确保您已完成 在您开始之前 下的步骤。

在此配置中,每个控制平面都会观察两个集群中的 API 服务器以获取端点。

服务工作负载在集群边界之间直接通信(Pod 到 Pod)。

Multiple primary clusters on the same network
同一网络上的多个主集群

cluster1 配置为主节点

cluster1创建 Istio 配置。

$ cat <<EOF > cluster1.yaml
apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
spec:
  values:
    global:
      meshID: mesh1
      multiCluster:
        clusterName: cluster1
      network: network1
EOF

将配置应用于cluster1

$ istioctl install --context="${CTX_CLUSTER1}" -f cluster1.yaml

cluster2 配置为主节点

cluster2创建 Istio 配置。

$ cat <<EOF > cluster2.yaml
apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
spec:
  values:
    global:
      meshID: mesh1
      multiCluster:
        clusterName: cluster2
      network: network1
EOF

将配置应用于cluster2

$ istioctl install --context="${CTX_CLUSTER2}" -f cluster2.yaml

启用端点发现

cluster2中安装一个远程密钥,用于访问cluster1的 API 服务器。

$ istioctl create-remote-secret \
    --context="${CTX_CLUSTER1}" \
    --name=cluster1 | \
    kubectl apply -f - --context="${CTX_CLUSTER2}"

cluster1中安装一个远程密钥,用于访问cluster2的 API 服务器。

$ istioctl create-remote-secret \
    --context="${CTX_CLUSTER2}" \
    --name=cluster2 | \
    kubectl apply -f - --context="${CTX_CLUSTER1}"

恭喜!您已成功在多个主集群中安装 Istio 网格!

下一步

您现在可以验证安装

清理

  1. 卸载cluster1中的 Istio。

    $ istioctl uninstall --context="${CTX_CLUSTER1}" -y --purge
    $ kubectl delete ns istio-system --context="${CTX_CLUSTER1}"
    
  2. 卸载cluster2中的 Istio。

    $ istioctl uninstall --context="${CTX_CLUSTER2}" -y --purge
    $ kubectl delete ns istio-system --context="${CTX_CLUSTER2}"
    
这些信息对您有帮助吗?
您有任何改进建议吗?

感谢您的反馈!