Discover Services External to Pivotal Application Service
Pivotal Application Service (PAS) is a cloud-agnostic platform for running applications. It abstracts away the complexity of running your own infrastructure and networking for an application and gives developers the ability to focus on writing code. It has many features, including its own internal service discovery. In hybrid environments, where workloads can run on multiple platforms or clouds, applications running on PAS may need to discover services external to the platform.
Consul’s DNS interface is one of its primary querying interfaces for discovering external services. This introductory tutorial describes the basics on how to configure your PAS installation to delegate DNS lookups for Consul-specific domains to the Consul servers.
Prerequisites
This tutorial assumes basic familiarity with Consul, PAS, as well as its tools, like BOSH and Ops Manager. You will be able complete this tutorial without production experience.
Here is what you will need for this tutorial:
- A running installation of PAS
- Ability to make and apply changes in Pivotal Ops Manager
- Ability to push applications to PAS
- IPs or DNS name(s) of the Consul servers that you will be connecting to
You will also need to ensure that the container host VMs (aka Diego VMs) have network connectivity to the Consul servers.
Configure PAS to use Consul DNS
Log in to your Pivotal Ops Manager instance, use Pivotal documentation for instructions specific to your installation.
From your installation dashboard navigate to the “BOSH DNS Config Page” within the BOSH Director tile.
Add the following configuration to the Handlers
field, setting recursors
to
the IPs or DNS names of your Consul servers.
This configuration sets the Consul server running on 10.52.0.63
and the
default DNS port 8600
.
If the Consul server is configured with a different
domain, make sure to
change the domain
property above to reflect that.
Your resulting page should include the configuration in the Handlers
field.
When ready, click "Save". Note that you will need to review and apply pending changes in Ops Manager to apply the configuration.
Discover a service with Consul DNS
Now that you have configured Consul’s DNS as a query interface, you can test that it works by deploying a simple demo application. From the demo application container, you will be able to query Consul DNS.
First, log in to PAS.
Create an organization.
Create a space.
Target an organization and a space.
Next, download the demo application.
Move into the directory for the downloaded app.
Deploy the demo application.
The demo application is maintained by Cloud Foundry.
Finally, SSH into the demo application container and use dig
to discover all
running instances of the Consul service.
Next steps
In this tutorial you learned how to configure Pivotal Application Service (PAS) to use Consul’s DNS interface for service discovery of external services. If you have services deployed in hybrid environments, such as VMs or Kubernetes, you will now be able to discover them using Consul’s DNS interface.
Learn more about Consul service discovery and registration and Consul’s DNS interface.