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. ThePeerNameis 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: "")-The admin partition to use. If not provided, the partition is inferred from the request's ACL token, or defaults to theEnterprisedefaultpartition.
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
{
"PeerName": "cluster-02",
"Meta": {
"env": "production"
}
}