connect Block
Placement | job -> group -> service -> connect |
The connect
block allows configuring various options for
Consul Connect. It is
valid only within the context of a service definition at the task group
level. For using connect
when Consul ACLs are enabled, be sure to read through
the Secure Nomad Jobs with Consul Connect
guide.
connect
Parameters
Used to configure a connect service. Only one of native
, sidecar_service
,
or gateway
may be realized per connect
block.
native
-(bool: false)
- This is used to configure the service as supporting Connect Native applications.sidecar_service
-(sidecar_service: nil)
- This is used to configure the sidecar service created by Nomad for Consul Connect.sidecar_task
-(sidecar_task:nil)
- This modifies the task configuration of the Envoy proxy created as a sidecar or gateway.gateway
-(gateway:nil)
- This is used to configure the gateway service created by Nomad for Consul Connect.
connect
Examples
Using Connect Native
The following example is a minimal service block for a
Consul Connect Native
application implemented by a task named generate
.
Using Sidecar Service
The following example is a minimal connect block with defaults and is sufficient to start an Envoy proxy sidecar for allowing incoming connections via Consul Connect.
The following example includes specifying upstreams
.
The following is the complete countdash
example. It includes an API service
and a frontend Dashboard service which connects to the API service as a Connect
upstream. Once running, the dashboard is accessible at localhost:9002
.
Using a Gateway
The following is an example service block for creating and using a connect ingress gateway. It includes a gateway service definition and an api service fronted by the gateway. Once running, the gateway can be used to reach the api service by first looking up the gateway Consul DNS address, e.g.