Cluster Peering - HTTP API
The functionality described here is available only in Consul version 1.13.0 and later.
Generate a Peering Token
This endpoint generates a peering token.
Method | Path | Produces |
---|---|---|
POST | /peering/token | application/json |
The table below shows this endpoint's support for blocking queries, consistency modes, agent caching, and required ACLs.
Blocking Queries | Consistency Modes | Agent Caching | ACL Required |
---|---|---|---|
NO | none | none | peering:write |
JSON Request Body Schema
PeerName
(string: <required>)
- The name assigned to the peer cluster. ThePeerName
is used to reference the peer cluster in service discovery queries and configuration entries such asservice-intentions
. This field must be a valid DNS hostname label.
Partition
(string: "")
- Enterprise The admin partition to use. If not provided, the partition is inferred from the request's ACL token, or defaults to thedefault
partition.
ServerExternalAddresses
([]string: <optional>)
- The addresses for the cluster that generates the peering token. Addresses take the form{host or IP}:port
. You can specify one or more load balancers or external IPs that route external traffic to this cluster's Consul servers.Meta
(map<string|string>: <optional>)
- Specifies KV metadata to associate with the peering. This parameter is not required and does not directly impact the cluster peering process.
Sample Payload
Sample Request
Sample Response
Establish a Peering Connection
This endpoint establishes a peering connection with a given peering token.
Method | Path | Produces |
---|---|---|
POST | /peering/establish | application/json |
This endpoint returns no data. Success or failure is indicated by the status code returned.
The table below shows this endpoint's support for blocking queries, consistency modes, agent caching, and required ACLs.
Blocking Queries | Consistency Modes | Agent Caching | ACL Required |
---|---|---|---|
NO | none | none | peering:write |
JSON Request Body Schema
PeerName
(string: <required>)
- The name assigned to the peer cluster. ThePeerName
is used to reference the peer cluster in service discovery queries and configuration entries such asservice-intentions
. This field must be a valid DNS hostname label.
Partition
(string: "")
- Enterprise The admin partition to use. If not provided, the partition is inferred from the request's ACL token, or defaults to thedefault
partition.
PeeringToken
(string: <required>)
- The peering token fetched from the peer cluster.Meta
(map<string|string>: <optional>)
- Specifies KV metadata to associate with the peering. This parameter is not required and does not directly impact the cluster peering process.
Sample Payload
Sample Request
Sample Response
Read a Peering Connection
This endpoint returns information about a peering connection for the specified peer name.
Method | Path | Produces |
---|---|---|
GET | /peering/:name | application/json |
The table below shows this endpoint's support for blocking queries, consistency modes, agent caching, and required ACLs.
Blocking Queries | Consistency Modes | Agent Caching | ACL Required |
---|---|---|---|
YES | consistent | none | peering:read |
Path Parameters
name
(string: <required>)
- Specifies the peering to read.
Query Parameters
partition
(string: "")
Enterprise - The admin partition to use. If not provided, the partition is inferred from the request's ACL token, or defaults to thedefault
partition.
Sample Request
Sample Response
Delete a Peering Connection
Call this endpoint to delete a peering connection. Consul deletes all data imported from the peer in the background. The peering connection is removed after all associated data has been deleted.
Operators can still read the peering connections while the data is being removed. A DeletedAt
field will be populated with the timestamp of when the peering was marked for deletion.
Method | Path | Produces |
---|---|---|
DELETE | /peering/:name | N/A |
This endpoint returns no data. Success or failure is indicated by the status code returned.
The table below shows this endpoint's support for blocking queries, consistency modes, agent caching, and required ACLs.
Blocking Queries | Consistency Modes | Agent Caching | ACL Required |
---|---|---|---|
NO | none | none | peering:write |
Path Parameters
name
(string: <required>)
- Specifies the name of the peering to delete.
Query Parameters
partition
(string: "")
Enterprise - The admin partition to use. If not provided, the partition is inferred from the request's ACL token, or defaults to thedefault
partition.
Sample Request
Sample Read Output After Deletion Prior to Removal
List all Peerings
This endpoint lists all the peerings.
The HTTP response includes the X-Consul-Results-Filtered-By-ACLs: true
header
if the response array excludes results due to ACL policy configuration.
Refer to the HTTP API documentation for more information.
Method | Path | Produces |
---|---|---|
GET | /peerings | application/json |
The table below shows this endpoint's support for blocking queries, consistency modes, agent caching, and required ACLs.
Blocking Queries | Consistency Modes | Agent Caching | ACL Required |
---|---|---|---|
YES | consistent | background refresh | peering:read |
Query Parameters
partition
(string: "")
Enterprise - The admin partition to use. If not provided, the partition is inferred from the request's ACL token, or defaults to thedefault
partition.
Sample Request
Sample Response