docs: Clean up k8s cluster peering instructions (#15592)

This commit is contained in:
David Yu 2022-11-29 12:58:13 -06:00 committed by GitHub
parent 95dc0c7b30
commit 54a3714543
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 15 deletions

View File

@ -47,26 +47,20 @@ Complete the following procedure after you have provisioned a Kubernetes cluster
$ export CLUSTER2_CONTEXT=<CONTEXT for second Kubernetes cluster>
```
1. To establish cluster peering through Kubernetes, create a `values.yaml` file with the following Helm values.
1. To establish cluster peering through Kubernetes, create a `values.yaml` file with the following Helm values. **NOTE:** Mesh Gateway replicas are defaulted to 1 replica, and could be adjusted using the `meshGateway.replicas` value for higher availaibity.
<CodeBlockConfig filename="values.yaml">
```yaml
global:
name: consul
image: "hashicorp/consul:1.14.0"
image: "hashicorp/consul:1.14.1"
peering:
enabled: true
tls:
enabled: true
connectInject:
enabled: true
dns:
enabled: true
enableRedirection: true
meshGateway:
enabled: true
replicas: 1
```
</CodeBlockConfig>
@ -82,7 +76,7 @@ Install Consul on Kubernetes by using the CLI to apply `values.yaml` to each clu
```
```shell-session
$ helm install ${HELM_RELEASE_NAME} hashicorp/consul --create-namespace --namespace consul --version "1.0.0" --values values.yaml --kube-context $CLUSTER1_CONTEXT
$ helm install ${HELM_RELEASE_NAME} hashicorp/consul --create-namespace --namespace consul --version "1.0.1" --values values.yaml --set global.datacenter=dc1 --kube-context $CLUSTER1_CONTEXT
```
1. In `cluster-02`, run the following commands:
@ -92,7 +86,7 @@ Install Consul on Kubernetes by using the CLI to apply `values.yaml` to each clu
```
```shell-session
$ helm install ${HELM_RELEASE_NAME} hashicorp/consul --create-namespace --namespace consul --version "1.0.0" --values values.yaml --set global.datacenter=dc2 --kube-context $CLUSTER2_CONTEXT
$ helm install ${HELM_RELEASE_NAME} hashicorp/consul --create-namespace --namespace consul --version "1.0.1" --values values.yaml --set global.datacenter=dc2 --kube-context $CLUSTER2_CONTEXT
```
## Create a peering connection for Consul on Kubernetes
@ -120,6 +114,10 @@ If the servers in `cluster-01` are not directly routable from the dialing cluste
```
</CodeBlockConfig>
```shell-session
$ kubectl --context $CLUSTER1_CONTEXT apply -f mesh.yaml
```
1. In `cluster-02` apply the `Mesh` custom resource so that the servers for `cluster-02` will use their local mesh gateway to dial the servers for `cluster-01`.
@ -136,6 +134,10 @@ If the servers in `cluster-01` are not directly routable from the dialing cluste
```
</CodeBlockConfig>
```shell-session
$ kubectl --context $CLUSTER2_CONTEXT apply -f mesh.yaml
```
### Create a peering token
@ -212,7 +214,7 @@ like to configure the mesh gateway mode such that this traffic always leaves thr
1. In `cluster-01` apply the following `ProxyDefaults` CRD to configure the mesh gateway mode.
<CodeBlockConfig filename="proxydefaults.yaml">
<CodeBlockConfig filename="proxy-defaults.yaml">
```yaml
apiVersion: consul.hashicorp.com/v1alpha1
@ -225,10 +227,14 @@ like to configure the mesh gateway mode such that this traffic always leaves thr
```
</CodeBlockConfig>
```shell-session
$ kubectl --context $CLUSTER1_CONTEXT apply -f proxy-defaults.yaml
```
1. In `cluster-02` apply the following `ProxyDefaults` CRD to configure the mesh gateway mode.
<CodeBlockConfig filename="proxydefaults.yaml">
<CodeBlockConfig filename="proxy-defaults.yaml">
```yaml
apiVersion: consul.hashicorp.com/v1alpha1
@ -241,6 +247,10 @@ like to configure the mesh gateway mode such that this traffic always leaves thr
```
</CodeBlockConfig>
```shell-session
$ kubectl --context $CLUSTER1_CONTEXT apply -f proxy-defaults.yaml
```
### Export services between clusters
@ -309,12 +319,12 @@ The examples described in this section demonstrate how to export a service named
1. Deploy the `backend` service to the second cluster.
```shell-session
$ kubectl apply --context $CLUSTER2_CONTEXT --filename backend.yaml
$ kubectl --context $CLUSTER2_CONTEXT apply --filename backend.yaml
```
1. In `cluster-02`, create an `ExportedServices` custom resource.
<CodeBlockConfig filename="exportedsvc.yaml">
<CodeBlockConfig filename="exported-service.yaml">
```yaml
apiVersion: consul.hashicorp.com/v1alpha1
@ -333,7 +343,7 @@ The examples described in this section demonstrate how to export a service named
1. Apply the `ExportedServices` resource to the second cluster.
```shell-session
$ kubectl apply --context $CLUSTER2_CONTEXT --filename exportedsvc.yaml
$ kubectl --context $CLUSTER2_CONTEXT apply --filename exported-service.yaml
```
### Authorize services for peers