github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/website/pages/docs/integrations/consul-integration.mdx (about) 1 --- 2 layout: docs 3 page_title: Consul Integration 4 sidebar_title: Consul 5 description: Learn how to integrate Nomad with Consul and add service discovery to jobs 6 --- 7 8 # Consul Integration 9 10 [Consul][] is a tool for discovering and configuring services in your 11 infrastructure. Consul's key features include service discovery, health checking, 12 a KV store, and robust support for multi-datacenter deployments. Nomad's integration 13 with Consul enables automatic clustering, built-in service registration, and 14 dynamic rendering of configuration files and environment variables. The sections 15 below describe the integration in more detail. 16 17 ## Configuration 18 19 In order to use Consul with Nomad, you will need to configure and 20 install Consul on your nodes alongside Nomad, or schedule it as a system job. 21 Nomad does not currently run Consul for you. 22 23 To enable Consul integration, please see the 24 [Nomad agent Consul integration](/docs/configuration/consul) 25 configuration. 26 27 ## Automatic Clustering with Consul 28 29 Nomad servers and clients will be automatically informed of each other's 30 existence when a running Consul cluster already exists and the Consul agent is 31 installed and configured on each host. Please see the [Automatic Clustering with 32 Consul](https://learn.hashicorp.com/nomad/operating-nomad/clustering) guide for more information. 33 34 ## Service Discovery 35 36 Nomad schedules workloads of various types across a cluster of generic hosts. 37 Because of this, placement is not known in advance and you will need to use 38 service discovery to connect tasks to other services deployed across your 39 cluster. Nomad integrates with Consul to provide service discovery and 40 monitoring. 41 42 To configure a job to register with service discovery, please see the 43 [`service` job specification documentation][service]. 44 45 ## Dynamic Configuration 46 47 Nomad's job specification includes a [`template` stanza](/docs/job-specification/template) 48 that utilizes a Consul ecosystem tool called [Consul Template](https://github.com/hashicorp/consul-template). This mechanism creates a convenient way to ship configuration files 49 that are populated from environment variables, Consul data, Vault secrets, or just 50 general configurations within a Nomad task. 51 52 For more information on Nomad's template stanza and how it leverages Consul Template, 53 please see the [`template` job specification documentation](/docs/job-specification/template). 54 55 ## Assumptions 56 57 - Consul 0.7.2 or later is needed for `tls_skip_verify` in HTTP checks. 58 59 - Consul 0.6.4 or later is needed for using the Script checks. 60 61 - Consul 0.6.0 or later is needed for using the TCP checks. 62 63 - The service discovery feature in Nomad depends on operators making sure that 64 the Nomad client can reach the Consul agent. 65 66 - Tasks running inside Nomad also need to reach out to the Consul agent if 67 they want to use any of the Consul APIs. Ex: A task running inside a docker 68 container in the bridge mode won't be able to talk to a Consul Agent running 69 on the loopback interface of the host since the container in the bridge mode 70 has its own network interface and doesn't see interfaces on the global 71 network namespace of the host. There are a couple of ways to solve this, one 72 way is to run the container in the host networking mode, or make the Consul 73 agent listen on an interface in the network namespace of the container. 74 75 [consul]: https://www.consul.io/ 'Consul by HashiCorp' 76 [service]: /docs/job-specification/service 'Nomad service Job Specification'