> For the complete documentation index, see [llms.txt](https://rocdu.gitbook.io/deep-understanding-of-istio/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://rocdu.gitbook.io/deep-understanding-of-istio/4/1/2-1.md).

# 多主- 单网络平面

## 多主

安装cluster1和cluster2

每个控制平面都在两个集群中观察端点的API服务器,服务工作负载跨集群边界直接(点对点)通信。

![同一网络上的多个主集群](https://preliminary.istio.io/latest/docs/setup/install/multicluster/multi-primary/arch.svg)

```
# 配置cluster1为主

cat <<EOF > cluster1.yaml
apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
spec:
  values:
    global:
      meshID: mesh1
      multiCluster:
        clusterName: cluster1
      network: network1
EOF
istioctl install --context="${CTX_CLUSTER1}" -f cluster1.yaml
```

## 配置cluster2为主

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

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

## 启用端点发现

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

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