2019-09-05 18:08:31 +00:00
|
|
|
---
|
2020-02-06 23:45:31 +00:00
|
|
|
layout: docs
|
|
|
|
page_title: connect Stanza - Job Specification
|
|
|
|
sidebar_title: connect
|
|
|
|
description: The "connect" stanza allows specifying options for Consul Connect integration
|
2019-09-05 18:08:31 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
# `connect` Stanza
|
|
|
|
|
2020-02-06 23:45:31 +00:00
|
|
|
<Placement groups={['job', 'group', 'service', 'connect']} />
|
2019-09-05 18:08:31 +00:00
|
|
|
|
|
|
|
The `connect` stanza allows configuring various options for
|
2020-03-12 22:05:34 +00:00
|
|
|
[Consul Connect](/guides/integrations/consul-connect). It is
|
2019-09-05 18:08:31 +00:00
|
|
|
valid only within the context of a service definition at the task group
|
|
|
|
level.
|
|
|
|
|
|
|
|
```hcl
|
|
|
|
job "countdash" {
|
|
|
|
datacenters = ["dc1"]
|
|
|
|
group "api" {
|
|
|
|
network {
|
|
|
|
mode = "bridge"
|
|
|
|
}
|
|
|
|
|
|
|
|
service {
|
|
|
|
name = "count-api"
|
|
|
|
port = "9001"
|
|
|
|
|
|
|
|
connect {
|
|
|
|
sidecar_service {}
|
|
|
|
}
|
|
|
|
}
|
2019-10-22 22:57:14 +00:00
|
|
|
|
2019-09-05 18:08:31 +00:00
|
|
|
task "web" {
|
2019-10-22 22:57:14 +00:00
|
|
|
driver = "docker"
|
|
|
|
config {
|
|
|
|
image = "test/test:v1"
|
|
|
|
}
|
2019-09-05 18:08:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
## `connect` Parameters
|
|
|
|
|
|
|
|
- `sidecar_service` - <code>([sidecar_service][]: nil)</code> - This is used to configure the sidecar
|
|
|
|
service injected by Nomad for Consul Connect.
|
|
|
|
|
|
|
|
- `sidecar_task` - <code>([sidecar_task][]:nil)</code> - This modifies the configuration of the Envoy
|
|
|
|
proxy task.
|
|
|
|
|
|
|
|
## `connect` Examples
|
|
|
|
|
2019-09-06 05:52:11 +00:00
|
|
|
The following example is a minimal connect stanza with defaults and is
|
|
|
|
sufficient to start an Envoy proxy sidecar for allowing incoming connections
|
|
|
|
via Consul Connect.
|
2019-09-05 18:08:31 +00:00
|
|
|
|
|
|
|
```hcl
|
|
|
|
connect {
|
|
|
|
sidecar_service {}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2019-09-06 05:52:11 +00:00
|
|
|
The following example includes specifying [`upstreams`][upstreams].
|
2019-09-05 18:08:31 +00:00
|
|
|
|
|
|
|
```hcl
|
|
|
|
connect {
|
|
|
|
sidecar_service {
|
|
|
|
proxy {
|
|
|
|
upstreams {
|
|
|
|
destination_name = "count-api"
|
|
|
|
local_bind_port = 8080
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-02-06 23:45:31 +00:00
|
|
|
```
|
2019-09-05 18:08:31 +00:00
|
|
|
|
2019-09-06 05:52:11 +00:00
|
|
|
### Limitations
|
2019-09-05 18:08:31 +00:00
|
|
|
|
2019-09-06 05:52:11 +00:00
|
|
|
[Consul Connect Native services][native] and [Nomad variable
|
2020-02-06 23:45:31 +00:00
|
|
|
interpolation][interpolation] are _not_ supported in Nomad 0.10.0.
|
|
|
|
|
|
|
|
[job]: /docs/job-specification/job 'Nomad job Job Specification'
|
|
|
|
[group]: /docs/job-specification/group 'Nomad group Job Specification'
|
|
|
|
[task]: /docs/job-specification/task 'Nomad task Job Specification'
|
|
|
|
[interpolation]: /docs/runtime/interpolation 'Nomad interpolation'
|
|
|
|
[sidecar_service]: /docs/job-specification/sidecar_service 'Nomad sidecar service Specification'
|
|
|
|
[sidecar_task]: /docs/job-specification/sidecar_task 'Nomad sidecar task config Specification'
|
|
|
|
[upstreams]: /docs/job-specification/upstreams 'Nomad sidecar service upstreams Specification'
|
2019-09-06 05:52:11 +00:00
|
|
|
[native]: https://www.consul.io/docs/connect/native.html
|