docs: minor changes to cluster peering k8s docs and typos (#14442)
* docs: minor changes to cluster peering k8s docs and typos
This commit is contained in:
parent
ef5f697121
commit
fd8b367dc0
|
@ -61,7 +61,7 @@ You must implement the following requirements to create and use cluster peering
|
||||||
enableRedirection: true
|
enableRedirection: true
|
||||||
server:
|
server:
|
||||||
exposeService:
|
exposeService:
|
||||||
enabeld: true
|
enabled: true
|
||||||
controller:
|
controller:
|
||||||
enabled: true
|
enabled: true
|
||||||
meshGateway:
|
meshGateway:
|
||||||
|
@ -166,14 +166,14 @@ To peer Kubernetes clusters running Consul, you need to create a peering token a
|
||||||
|
|
||||||
1. For the service in "cluster-02" that you want to export, add the following [annotation](/docs/k8s/annotations-and-labels) to your service's pods.
|
1. For the service in "cluster-02" that you want to export, add the following [annotation](/docs/k8s/annotations-and-labels) to your service's pods.
|
||||||
|
|
||||||
<CodeBlockConfig filename="backend-service.yaml">
|
<CodeBlockConfig filename="backend.yaml">
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# Service to expose backend
|
# Service to expose backend
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: backend-service
|
name: backend
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
app: backend
|
app: backend
|
||||||
|
@ -235,7 +235,7 @@ To peer Kubernetes clusters running Consul, you need to create a peering token a
|
||||||
name: default ## The name of the partition containing the service
|
name: default ## The name of the partition containing the service
|
||||||
spec:
|
spec:
|
||||||
services:
|
services:
|
||||||
- name: backend-service ## The name of the service you want to export
|
- name: backend ## The name of the service you want to export
|
||||||
consumers:
|
consumers:
|
||||||
- peer: cluster-01 ## The name of the peer that receives the service
|
- peer: cluster-01 ## The name of the peer that receives the service
|
||||||
```
|
```
|
||||||
|
@ -245,7 +245,7 @@ To peer Kubernetes clusters running Consul, you need to create a peering token a
|
||||||
1. Apply the service file and the `ExportedServices` resource for the second cluster.
|
1. Apply the service file and the `ExportedServices` resource for the second cluster.
|
||||||
|
|
||||||
```shell-session
|
```shell-session
|
||||||
$ kubectl apply --context $CLUSTER2_CONTEXT --filename backend-service.yaml --filename exportedsvc.yaml
|
$ kubectl apply --context $CLUSTER2_CONTEXT --filename backend.yaml --filename exportedsvc.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
## Authorize services for peers
|
## Authorize services for peers
|
||||||
|
@ -261,11 +261,11 @@ To peer Kubernetes clusters running Consul, you need to create a peering token a
|
||||||
name: backend-deny
|
name: backend-deny
|
||||||
spec:
|
spec:
|
||||||
destination:
|
destination:
|
||||||
name: backend-service
|
name: backend
|
||||||
sources:
|
sources:
|
||||||
- name: "*"
|
- name: "*"
|
||||||
action: deny
|
action: deny
|
||||||
- name: frontend-service
|
- name: frontend
|
||||||
action: allow
|
action: allow
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -277,16 +277,16 @@ To peer Kubernetes clusters running Consul, you need to create a peering token a
|
||||||
$ kubectl --context $CLUSTER2_CONTEXT apply --filename intention.yml
|
$ kubectl --context $CLUSTER2_CONTEXT apply --filename intention.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
1. For the services in `cluster-01` that you want to access the "backend-service," add the following annotations to the service file. To dial the upstream service from an application, ensure that the requests are sent to the correct DNS name as specified in [Service Virtual IP Lookups](/docs/discovery/dns#service-virtual-ip-lookups).
|
1. For the services in `cluster-01` that you want to access the "backend," add the following annotations to the service file. To dial the upstream service from an application, ensure that the requests are sent to the correct DNS name as specified in [Service Virtual IP Lookups](/docs/discovery/dns#service-virtual-ip-lookups).
|
||||||
|
|
||||||
<CodeBlockConfig filename="frontend-service.yaml">
|
<CodeBlockConfig filename="frontend.yaml">
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# Service to expose frontend
|
# Service to expose frontend
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: frontend-service
|
name: frontend
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
app: frontend
|
app: frontend
|
||||||
|
@ -332,7 +332,7 @@ To peer Kubernetes clusters running Consul, you need to create a peering token a
|
||||||
- name: "LISTEN_ADDR"
|
- name: "LISTEN_ADDR"
|
||||||
value: "0.0.0.0:9090"
|
value: "0.0.0.0:9090"
|
||||||
- name: "UPSTREAM_URIS"
|
- name: "UPSTREAM_URIS"
|
||||||
value: "http://backend-service.virtual.cluster-02.consul"
|
value: "http://backend.virtual.cluster-02.consul"
|
||||||
- name: "NAME"
|
- name: "NAME"
|
||||||
value: "frontend"
|
value: "frontend"
|
||||||
- name: "MESSAGE"
|
- name: "MESSAGE"
|
||||||
|
@ -346,10 +346,10 @@ To peer Kubernetes clusters running Consul, you need to create a peering token a
|
||||||
1. Apply the service file to the first cluster.
|
1. Apply the service file to the first cluster.
|
||||||
|
|
||||||
```shell-session
|
```shell-session
|
||||||
$ kubectl --context $CLUSTER1_CONTEXT apply --filename frontend-service.yaml
|
$ kubectl --context $CLUSTER1_CONTEXT apply --filename frontend.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Run the following command in `frontend-service` and check the output to confirm that you peered your clusters successfully.
|
1. Run the following command in `frontend` and check the output to confirm that you peered your clusters successfully.
|
||||||
|
|
||||||
```shell-session
|
```shell-session
|
||||||
$ kubectl --context $CLUSTER1_CONTEXT exec -it $(kubectl --context $CLUSTER1_CONTEXT get pod -l app=frontend -o name) -- curl localhost:9090
|
$ kubectl --context $CLUSTER1_CONTEXT exec -it $(kubectl --context $CLUSTER1_CONTEXT get pod -l app=frontend -o name) -- curl localhost:9090
|
||||||
|
@ -365,9 +365,9 @@ To peer Kubernetes clusters running Consul, you need to create a peering token a
|
||||||
"duration": "59.752279ms",
|
"duration": "59.752279ms",
|
||||||
"body": "Hello World",
|
"body": "Hello World",
|
||||||
"upstream_calls": {
|
"upstream_calls": {
|
||||||
"http://backend-service.virtual.cluster-02.consul": {
|
"http://backend.virtual.cluster-02.consul": {
|
||||||
"name": "backend",
|
"name": "backend",
|
||||||
"uri": "http://backend-service.virtual.cluster-02.consul",
|
"uri": "http://backend.virtual.cluster-02.consul",
|
||||||
"type": "HTTP",
|
"type": "HTTP",
|
||||||
"ip_addresses": [
|
"ip_addresses": [
|
||||||
"10.32.2.10"
|
"10.32.2.10"
|
||||||
|
|
Loading…
Reference in New Issue