How to access consul services from nomad

Hello everyone,

I am trying to deploy an ambassador pattern kind of an application on my dev environment. Basically playing around with consul/nomad.

Basically what I am trying to do is the following. Deploy container X using nomad, which in turn will distribute/shard connections to containers A,B,C.

I have deployed containers A,B,C in nomad using the service stanza. I can see the containers up, running and deployed and I can also see that service registered in consul if I use the command consul catalog. What I can figure out is how do I “discover” those nodes from container X.

Container X basically has a YAML config file with the following as an example:

application_1:
backend_servers:

  • s1
  • s2
  • s3

So how do i automatically discover those 3? In k8s for instance I would use the service identifier and refer to the container as service-1/2/3.domain. Is this something that can be achieved in consul/nomad?

Thanks in advance.

NVM, I already found my answer :slight_smile: