Skip to content

Commit 7bf20dd

Browse files
committed
Update general cluster peering docs, reorder CLI > API > UI, cross link to kubernetes
1 parent 3533a73 commit 7bf20dd

File tree

9 files changed

+116
-121
lines changed

9 files changed

+116
-121
lines changed

website/content/docs/connect/cluster-peering/index.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ The following resources are available to help you use Consul's cluster peering f
6363

6464
**Runtime-specific information:**
6565

66-
- [Cluster peering on Kubernetes technical specifications](/consul/docs/k8s/connect/cluster-peering/k8s-tech-specs)
67-
- [Establish cluster peering connections on Kubernetes](/consul/docs/k8s/connect/cluster-peering/usage/k8s-establish-peering)
68-
- [Manage cluster peering connections on Kubernetes](/consul/docs/k8s/connect/cluster-peering/usage/k8s-manage-peering)
69-
- [Manage L7 traffic with cluster peering on Kubernetes](/consul/docs/k8s/connect/cluster-peering/usage/k8s-l7-traffic)
66+
- [Cluster peering on Kubernetes technical specifications](/consul/docs/k8s/connect/cluster-peering/tech-specs)
67+
- [Establish cluster peering connections on Kubernetes](/consul/docs/k8s/connect/cluster-peering/usage/establish-peering)
68+
- [Manage cluster peering connections on Kubernetes](/consul/docs/k8s/connect/cluster-peering/usage/manage-peering)
69+
- [Manage L7 traffic with cluster peering on Kubernetes](/consul/docs/k8s/connect/cluster-peering/usage/l7-traffic)
7070

7171
**Reference information:**
7272

website/content/docs/connect/cluster-peering/tech-specs.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ The `exported-services` configuration entry is required in order for services to
5858

5959
Basic guidance on using the `exported-services` configuration entry is included in [Establish cluster peering connections](/consul/docs/connect/cluster-peering/usage/create-cluster-peering).
6060

61-
Refer to the [`exported-services`](/consul/docs/connect/config-entries/exported-services) configuration entry reference for more information.
61+
Refer to the [`exported-services` configuration entry](/consul/docs/connect/config-entries/exported-services) reference for more information.
6262

6363
## ACL requirements
6464

website/content/docs/connect/cluster-peering/usage/establish-cluster-peering.mdx

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ description: >-
77

88
# Establish cluster peering connections
99

10-
This page details the process for establishing a cluster peering connection between services deployed to different datacenters. You can interact with Consul's cluster peering features using the HTTP API, the CLI, or the UI. The overall process for establishing a cluster peering connection consists of the following steps:
10+
This page details the process for establishing a cluster peering connection between services deployed to different datacenters. You can interact with Consul's cluster peering features using the CLI, the HTTP API, or the UI. The overall process for establishing a cluster peering connection consists of the following steps:
1111

1212
1. Create a peering token in one cluster.
1313
1. Use the peering token to establish peering with a second cluster.
@@ -16,6 +16,8 @@ This page details the process for establishing a cluster peering connection betw
1616

1717
Cluster peering between services cannot be established until all four steps are complete.
1818

19+
For Kubernetes-specific guidance for establishing cluster peering connections, refer to [Establish cluster peering connections on Kubernetes](/consul/docs/k8s/connect/cluster-peering/usage/establish-peering).
20+
1921
## Requirements
2022

2123
You must meet the following requirements to use cluster peering:
@@ -40,6 +42,19 @@ To begin the cluster peering process, generate a peering token in one of your cl
4042
Every time you generate a peering token, a single-use secret for establishing the secret is embedded in the token. Because regenerating a peering token invalidates the previously generated secret, you must use the most recently created token to establish peering connections.
4143

4244
<Tabs>
45+
<Tab heading="Consul CLI" group="cli">
46+
47+
1. In `cluster-01`, use the [`consul peering generate-token` command](/consul/commands/peering/generate-token) to issue a request for a peering token.
48+
49+
```shell-session
50+
$ consul peering generate-token -name cluster-02
51+
```
52+
53+
The CLI outputs the peering token, which is a base64-encoded string containing the token details.
54+
55+
1. Save this value to a file or clipboard to use in the next step on `cluster-02`.
56+
57+
</Tab>
4358
<Tab heading="HTTP API" group="api">
4459

4560
1. In `cluster-01`, use the [`/peering/token` endpoint](/consul/api-docs/peering#generate-a-peering-token) to issue a request for a peering token.
@@ -64,21 +79,6 @@ Every time you generate a peering token, a single-use secret for establishing th
6479
</CodeBlockConfig>
6580

6681
</Tab>
67-
68-
<Tab heading="Consul CLI" group="cli">
69-
70-
1. In `cluster-01`, use the [`consul peering generate-token` command](/consul/commands/peering/generate-token) to issue a request for a peering token.
71-
72-
```shell-session
73-
$ consul peering generate-token -name cluster-02
74-
```
75-
76-
The CLI outputs the peering token, which is a base64-encoded string containing the token details.
77-
78-
1. Save this value to a file or clipboard to use in the next step on `cluster-02`.
79-
80-
</Tab>
81-
8282
<Tab heading="Consul UI" group="ui">
8383

8484
To begin the cluster peering process, generate a peering token in one of your clusters. The other cluster uses this token to establish the peering connection.
@@ -99,32 +99,31 @@ Every time you generate a peering token, a single-use secret for establishing th
9999
Next, use the peering token to establish a secure connection between the clusters.
100100

101101
<Tabs>
102-
<Tab heading="HTTP API" group="api">
102+
<Tab heading="Consul CLI" group="cli">
103103

104-
1. In one of the client agents in "cluster-02," use `peering_token.json` and the [`/peering/establish` endpoint](/consul/api-docs/peering#establish-a-peering-connection) to establish the peering connection. This endpoint does not generate an output unless there is an error.
104+
1. In one of the client agents deployed to "cluster-02," issue the [`consul peering establish` command](/consul/commands/peering/establish) and specify the token generated in the previous step.
105105

106106
```shell-session
107-
$ curl --request POST --data @peering_token.json http://127.0.0.1:8500/v1/peering/establish
107+
$ consul peering establish -name cluster-01 -peering-token token-from-generate
108+
"Successfully established peering connection with cluster-01"
108109
```
109110

110-
When you connect server agents through cluster peering, their default behavior is to peer to the `default` partition. To establish peering connections for other partitions through server agents, you must add the `Partition` field to `peering_token.json` and specify the partitions you want to peer. For additional configuration information, refer to [Cluster Peering - HTTP API](/consul/api-docs/peering).
111+
When you connect server agents through cluster peering, they peer their default partitions. To establish peering connections for other partitions through server agents, you must add the `-partition` flag to the `establish` command and specify the partitions you want to peer. For additional configuration information, refer to [`consul peering establish` command](/consul/commands/peering/establish).
111112

112-
You can dial the `peering/establish` endpoint once per peering token. Peering tokens cannot be reused after being used to establish a connection. If you need to re-establish a connection, you must generate a new peering token.
113+
You can run the `peering establish` command once per peering token. Peering tokens cannot be reused after being used to establish a connection. If you need to re-establish a connection, you must generate a new peering token.
113114

114115
</Tab>
116+
<Tab heading="HTTP API" group="api">
115117

116-
<Tab heading="Consul CLI" group="cli">
117-
118-
1. In one of the client agents deployed to "cluster-02," issue the [`consul peering establish` command](/consul/commands/peering/establish) and specify the token generated in the previous step.
118+
1. In one of the client agents in "cluster-02," use `peering_token.json` and the [`/peering/establish` endpoint](/consul/api-docs/peering#establish-a-peering-connection) to establish the peering connection. This endpoint does not generate an output unless there is an error.
119119

120120
```shell-session
121-
$ consul peering establish -name cluster-01 -peering-token token-from-generate
122-
"Successfully established peering connection with cluster-01"
121+
$ curl --request POST --data @peering_token.json http://127.0.0.1:8500/v1/peering/establish
123122
```
124123

125-
When you connect server agents through cluster peering, they peer their default partitions. To establish peering connections for other partitions through server agents, you must add the `-partition` flag to the `establish` command and specify the partitions you want to peer. For additional configuration information, refer to [`consul peering establish` command](/consul/commands/peering/establish).
124+
When you connect server agents through cluster peering, their default behavior is to peer to the `default` partition. To establish peering connections for other partitions through server agents, you must add the `Partition` field to `peering_token.json` and specify the partitions you want to peer. For additional configuration information, refer to [Cluster Peering - HTTP API](/consul/api-docs/peering).
126125

127-
You can run the `peering establish` command once per peering token. Peering tokens cannot be reused after being used to establish a connection. If you need to re-establish a connection, you must generate a new peering token.
126+
You can dial the `peering/establish` endpoint once per peering token. Peering tokens cannot be reused after being used to establish a connection. If you need to re-establish a connection, you must generate a new peering token.
128127

129128
</Tab>
130129

@@ -194,7 +193,7 @@ Before you can call services from peered clusters, you must set service intentio
194193
You must use the HTTP API or the Consul CLI to complete this step. The Consul UI supports intentions for local clusters only.
195194

196195
<Tabs>
197-
<Tab heading="HTTP API" group="api">
196+
<Tab heading="Consul CLI" group="cli">
198197

199198
1. Create a configuration entry and specify the `Kind` as `"service-intentions"`. Declare the service on "cluster-02" that can access the service in "cluster-01." In the following example, the service intentions configuration entry authorizes the `backend-service` to communicate with the `frontend-service` that is hosted on remote peer `cluster-02`:
200199

@@ -220,12 +219,11 @@ You must use the HTTP API or the Consul CLI to complete this step. The Consul UI
220219
1. Add the configuration entry to your cluster.
221220

222221
```shell-session
223-
$ curl --request PUT --data @peering-intentions.hcl http://127.0.0.1:8500/v1/config
222+
$ consul config write peering-intentions.hcl
224223
```
225224

226225
</Tab>
227-
228-
<Tab heading="Consul CLI" group="cli">
226+
<Tab heading="HTTP API" group="api">
229227

230228
1. Create a configuration entry and specify the `Kind` as `"service-intentions"`. Declare the service on "cluster-02" that can access the service in "cluster-01." In the following example, the service intentions configuration entry authorizes the `backend-service` to communicate with the `frontend-service` that is hosted on remote peer `cluster-02`:
231229

@@ -251,7 +249,7 @@ You must use the HTTP API or the Consul CLI to complete this step. The Consul UI
251249
1. Add the configuration entry to your cluster.
252250

253251
```shell-session
254-
$ consul config write peering-intentions.hcl
252+
$ curl --request PUT --data @peering-intentions.hcl http://127.0.0.1:8500/v1/config
255253
```
256254

257255
</Tab>

website/content/docs/connect/cluster-peering/usage/manage-connections.mdx

Lines changed: 28 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,17 @@ description: >-
77

88
# Manage cluster peering connections
99

10-
This usage topic describes how to manage cluster peering connections using the HTTP API, the CLI, and the UI.
10+
This usage topic describes how to manage cluster peering connections using the CLI, the HTTP API, and the UI.
1111

1212
After you establish a cluster peering connection, you can get a list of all active peering connections, read a specific peering connection's information, and delete peering connections.
1313

14+
For Kubernetes-specific guidance for managing cluster peering connections, refer to [Manage cluster peering connections on Kubernetes](/consul/docs/k8s/connect/cluster-peering/usage/manage-peering).
15+
1416
## List all peering connections
1517

1618
You can list all active peering connections in a cluster.
1719

1820
<Tabs>
19-
20-
<Tab heading="HTTP API" group="api">
21-
22-
The following example shows how to format an API request to list peering connections:
23-
24-
```shell-session
25-
$ curl --header "X-Consul-Token: 0137db51-5895-4c25-b6cd-d9ed992f4a52" http://127.0.0.1:8500/v1/peerings
26-
```
27-
28-
For more information, including optional parameters and sample responses, refer to the [`/peering` endpoint reference](/consul/api-docs/peering#list-all-peerings).
29-
30-
</Tab>
31-
3221
<Tab heading="Consul CLI" group="cli">
3322

3423
```shell-session
@@ -41,7 +30,17 @@ For more information, including optional parameters and sample responses, refer
4130
For more information, including optional flags and parameters, refer to the [`consul peering list` CLI command reference](/consul/commands/peering/list).
4231

4332
</Tab>
33+
<Tab heading="HTTP API" group="api">
4434

35+
The following example shows how to format an API request to list peering connections:
36+
37+
```shell-session
38+
$ curl --header "X-Consul-Token: 0137db51-5895-4c25-b6cd-d9ed992f4a52" http://127.0.0.1:8500/v1/peerings
39+
```
40+
41+
For more information, including optional parameters and sample responses, refer to the [`/peering` endpoint reference](/consul/api-docs/peering#list-all-peerings).
42+
43+
</Tab>
4544
<Tab heading="Consul UI" group="ui">
4645

4746
In the Consul UI, click **Peers**.
@@ -57,16 +56,6 @@ You can get information about individual peering connections between clusters.
5756

5857
<Tabs>
5958

60-
<Tab heading="HTTP API" group="api">
61-
62-
```shell-session
63-
$ curl --header "X-Consul-Token: b23b3cad-5ea1-4413-919e-c76884b9ad60" http://127.0.0.1:8500/v1/peering/cluster-02
64-
```
65-
66-
For more information, including optional parameters and sample responses, refer to the [`/peering` endpoint reference](/consul/api-docs/peering#read-a-peering-connection).
67-
68-
</Tab>
69-
7059
<Tab heading="Consul CLI" group="cli">
7160

7261
The following example outputs information about a peering connection locally referred to as "cluster-02":
@@ -95,7 +84,15 @@ The following example outputs information about a peering connection locally ref
9584
For more information, including optional flags and parameters, refer to the [`consul peering read` CLI command reference](/consul/commands/peering/read).
9685

9786
</Tab>
87+
<Tab heading="HTTP API" group="api">
9888

89+
```shell-session
90+
$ curl --header "X-Consul-Token: b23b3cad-5ea1-4413-919e-c76884b9ad60" http://127.0.0.1:8500/v1/peering/cluster-02
91+
```
92+
93+
For more information, including optional parameters and sample responses, refer to the [`/peering` endpoint reference](/consul/api-docs/peering#read-a-peering-connection).
94+
95+
</Tab>
9996
<Tab heading="Consul UI" group="ui">
10097

10198
1. In the Consul UI, click **Peers**.
@@ -110,15 +107,6 @@ For more information, including optional flags and parameters, refer to the [`co
110107
You can disconnect the peered clusters by deleting their connection. Deleting a peering connection stops data replication to the peer and deletes imported data, including services and CA certificates.
111108

112109
<Tabs>
113-
<Tab heading="HTTP API" group="api">
114-
115-
```shell-session
116-
$ curl --request DELETE --header "X-Consul-Token: b23b3cad-5ea1-4413-919e-c76884b9ad60" http://127.0.0.1:8500/v1/peering/cluster-02
117-
```
118-
119-
This endpoint does not return a response. For more information, including optional parameters, refer to the [`/peering` endpoint reference](/consul/api-docs/peering/consul/api-docs/peering#delete-a-peering-connection).
120-
</Tab>
121-
122110
<Tab heading="Consul CLI" group="cli">
123111

124112
The following examples deletes a peering connection to a cluster locally referred to as "cluster-02":
@@ -131,7 +119,14 @@ This endpoint does not return a response. For more information, including option
131119
For more information, including optional flags and parameters, refer to the [`consul peering delete` CLI command reference](/consul/commands/peering/delete).
132120

133121
</Tab>
122+
<Tab heading="HTTP API" group="api">
134123

124+
```shell-session
125+
$ curl --request DELETE --header "X-Consul-Token: b23b3cad-5ea1-4413-919e-c76884b9ad60" http://127.0.0.1:8500/v1/peering/cluster-02
126+
```
127+
128+
This endpoint does not return a response. For more information, including optional parameters, refer to the [`/peering` endpoint reference](/consul/api-docs/peering/consul/api-docs/peering#delete-a-peering-connection).
129+
</Tab>
135130
<Tab heading="Consul UI" group="ui">
136131

137132
1. In the Consul UI, click **Peers**. The UI lists peering connections you created for clusters in that datacenter.

0 commit comments

Comments
 (0)