Route Traffic to Peered Services
This topic describes how to configure Consul API Gateway to route traffic to services connected to the mesh through a cluster peering connection.
Requirements
- Consul v1.14 or later
- Verify that the requirements have been met.
- Verify that the Consul API Gateway CRDs and controller have been installed and applied. Refer to Installation for details.
- A peering connection must already be established between Consul clusters. Refer to Cluster Peering on Kubernetes for instructions.
- The Consul service that you want to route traffic to must be exported to the cluster containing your
Gateway
. Refer to Cluster Peering on Kubernetes for instructions. - A
ServiceResolver
for the Consul service you want to route traffic to must be created in the cluster that contains yourGateway
. Refer to Service Resolver Configuration Entry for instructions.
Configuration
Specify the following fields in your MeshService
configuration to use this feature. Refer to the MeshService configuration reference for details about the parameters.
Example
In the following example, routes that use example-mesh-service
as a backend are configured to send requests to the echo
service exported by the peered Consul cluster cluster-02
.
serviceresolver.yaml
meshservice.yaml
After applying the meshservice.yaml
configuration, an HTTPRoute
may then reference example-mesh-service
as its backendRef
.
route.yaml