Discover Services with Consul


This document provides instructions on how to discover service endpoints using Hashicorp Consul. Service discovery enables you to find the endpoints where a given service is available. To know more information about service discovery, see Volterra Service Discovery.

Using the instructions provided in this guide, you can create a discovery object and endpoint for a service using the service name and the location where the service is available.

Note: The service name is obtained from Consul.


Note: If you do not have an account, see Create a VES Account.

  • Consul with a service or application reachable from a Volterra Site

Note: Install the Volterra Node or Cluster Image in your cloud or edge location.


Volterra enables you to discover existing service endpoints using multiple methods, including the Hashicorp Consul. This document covers service discovery on sites, virtual sites, or virtual networks using the Consul information.

The following figure shows the configuration workflow for service discovery with consul:

Figure: Setting up Service Discovery with Consul

Configuration Sequence

Discovering services using the Consul service information requires performing the following sequence of actions:

Phase Description
Create Discovery Object with Consul Create a discovery object with Consul as the method and configure access credentials.
Create Endpoint with Consul Service Information Configure endpoint with Consul as the discovery type and associate sites with it.

Create Discovery Object with Consul

Step 1: Open the Consul GUI and confirm that the services are discovered.

The following image shows a sample of Consul nodes view:

Figure: Service Discovery Consul Node

The following image shows a sample of Consul services view:

Figure: Service Discovery Consul Service

Step 2: Log on to VoltConsole and create a discovery configuration object in the ‘System’ namespace. Select system from the ‘namespace’ menu. Select Manage from configuration menu and Discovery from the options pane. Click Add discovery. The discovery object form gets loaded.

Figure: Service Discovery Creation

Step 3: Enter name, labels, and description in the Name, Labels, and Description fields respectively.

Figure: Service Discovery Config Options

Step 4: Configure access information and configuration type as per the following guidelines:

  • Select Consul for the Access info field.
  • Enter an API server address in the API server field.
  • Enter Consul server name in the Server name field.

Figure: Service Discovery Consul Config Options

Step 5: Enter the security information such as certificate, key, and credentials.

Figure: Service Discovery Consul Config Options

Step 6: Select CONSUL as the discovery type in the Type field, enter subdomain in the Subdomain field, and select CORE_DNS as the DNS mode. Click Apply.

Figure: Service Discovery Network Type Config Options

Step 6: Click Add discovery button to create the discovery object.

With the above configuration, Volterra reads all the discovered services seamlessly from the Consul server.

Create Endpoint with Consul Service Information

Step 1: Select the desired namespace or create a namespace where endpoint needs to be created.

Figure: Navigate to Namespace

Step 2: Select Manage from the configuration menu and Endpoints from the options pane. Click Add endpoint.

Figure: Endpoint Creation

Step 3: Enter name, labels, and description in the Name, Labels, and Description fields respectively.

Figure: Endpoint Config Options

Step 4: Configure service or application information as per the following guidelines.

  • Select Service info for the Endpoint Address field.
  • Select Service name for the Service info field.
  • Enter your service name in the Service name field.
  • Select CONSUL for the Discovery type field.

Figure: Endpoint Discovery Type Consul Config

Note: You can use Consul UI or Consul CLI to retrieve the service information. In this case, you can directly use the ‘Service Name’ as discovered in the Consul and omit any namespace information.

Step 12: Configure where the endpoint should be discovered. Select an appropriate option in the RefOrSelector field. Click Select ref.

Figure: Endpoint Address Reference Selector

Any reference object (site, virtual site, or virtual network) needs to be created and listed before configuring this field. All the available object list gets displayed on a cascading menu where you can select one or more objects.

Figure: Endpoint Site Reference Selection

Step 13: Enter port and protocol values for the fields Port and Protocol respectively.

Figure: Endpoint Port and Protocol

With the above steps, you can discover a service endpoint from existing Consul server using ‘Service Info’ on a location specified using the selector. Once the service is discovered, the object can be used with other configuration objects of Volterra platform.


API References