Routing to external services

With Gloo Mesh, you can securely expose external endpoints, such as an on-prem database, to the services within your service mesh by using external endpoints and services. Similar to virtual destinations, you assign a unique internal hostname to your external endpoint that your services in the service mesh use to send requests to.

How does it work?

Because external endpoints cannot be automatically discovered by Gloo Mesh, you create a Gloo Mesh ExternalEndpoint resource to specify the hostname or IP address, the port, and the protocol of the external endpoint that you want to reach. For example, let's say that you want to connect to an on-prem database that is spread across multiple data centers. Each instance is assigned a static IP address that you can use to connect to the instance. To reach a database instance from within your service mesh, you now create two external endpoints in Gloo Mesh, one for each database instance. Each endpoint holds the information what IP address, port, and protocol must be used to connect to the database instance.

But how do you make sure that your services in your service mesh are aware of all the external endpoints that you created and that requests to these endpoints are load balanced accordingly? Maybe, you even want requests from your service mesh to be routed to the closest external endpoint by default. You can solve these problems by using the Gloo Mesh ExternalService resource.

The external service resource lets you expose all of the external endpoints under a unique internal hostname. The services in your service mesh simply send a request to the internal hostname, and the external service resource automatically forwards the request to the external endpoint taking into account the load balancing and locality rules that you defined.

Routing to external endpoints based on locality

The following diagram shows how the client sends a request to one of the on-prem database instances by using the database.mesh.external:80 address that was defined in the Gloo Mesh external service. You can configure the external service to consider the external endpoint's locality before deciding what database instance receives the request. Because the cluster and the on-prem data center are both located in Dallas, the request is routed to the database B instance in Dallas.

Routing to external services based on locality

Routing to external endpoints in a failover scenario

In this diagram, database instance B became unavailable and cannot respond to any requests. Because the external service is aware that the database instance is unresponsive, the request is automatically routed to database instance A.

Routing to external services in a failover scenario