Disc-Consul-Old
On This Page:
Objective
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.
Prerequisites
Note: If you do not have an account, see Create a Volterra 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.
Configuration
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:
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:
The following image shows a sample of Consul services view:
Step 2: Start creating discovery object in VoltConsole.
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.
Step 3: Enter the basic configuration.
Enter name, labels, and description in the Name
, Labels
, and Description
fields respectively.
Step 4: Configure access information and configuration type.
Enter the configuration as per the following guidelines:
- Select
Consul
for theAccess info
field. - Enter an API server address in the
API server
field. - Enter Consul server name in the
Server name
field.
Step 5: Enter the security configuration.
The security configuration consists of certificate, key, and credentials.
Step 6: Set discovery type, subdomain, and DNS mode.
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
.
Step 7: Complete creating discovery object.
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.
Step 2: Start creating endpoint.
Select Manage
from the configuration menu and Endpoints
from the options pane. Click Add endpoint
.
Step 3:Enter basic configuration for endpoint.
Enter name, labels, and description in the Name
, Labels
, and Description
fields respectively.
Step 4: Configure service or application information.
Set configuration as per the following guidelines.
- Select
Service info
for theEndpoint Address
field. - Select
Service name
for theService info
field. - Enter your service name in the
Service name
field. - Select
CONSUL
for theDiscovery type
field.
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 5: Specify where the endpoint is discoverd.
Configure where the endpoint should be discovered. Select an appropriate option in the RefOrSelector
field. Click Select ref
.
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.
Step 6: Enter port and protocol values and complete endpoint creation.
Select values for the fields Port
and Protocol
respectively. Click Add endpoint
to complete creating endpoint.
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.