open-nomad/website/pages/docs/job-specification/proxy.mdx

85 lines
2.5 KiB
Plaintext
Raw Normal View History

2019-09-05 18:08:31 +00:00
---
2020-02-06 23:45:31 +00:00
layout: docs
page_title: proxy Stanza - Job Specification
sidebar_title: proxy
2019-09-05 18:08:31 +00:00
description: |-
The "proxy" stanza allows specifying options for configuring
sidecar proxies used in Consul Connect integration
---
# `proxy` Stanza
2020-02-06 23:45:31 +00:00
<Placement
groups={['job', 'group', 'service', 'connect', 'sidecar_service', 'proxy']}
/>
2019-09-05 18:08:31 +00:00
The `proxy` stanza allows configuring various options for the sidecar proxy
managed by Nomad for [Consul
2020-03-06 03:37:19 +00:00
Connect](/docs/integrations/consul-connect). It is valid only
within the context of a `sidecar_service` stanza.
2019-09-05 18:08:31 +00:00
```hcl
job "countdash" {
datacenters = ["dc1"]
group "api" {
network {
mode = "bridge"
}
service {
name = "count-api"
port = "9001"
connect {
sidecar_service {}
}
}
task "web" {
driver = "docker"
config {
image = "test/test:v1"
}
}
}
}
```
## `proxy` Parameters
- `local_service_address` `(string: "127.0.0.1")` - The address the local service binds to. Useful to
customize in clusters with mixed Connect and non-Connect services.
- `local_service_port` <code>(int:[port][])</code> - The port the local service binds to.
2020-02-06 23:45:31 +00:00
Usually the same as the parent service's port, it is useful to customize in clusters with mixed
Connect and non-Connect services
- `upstreams` <code>([upstreams][]: nil)</code> - Used to configure details of each upstream service that
this sidecar proxy communicates with.
- `config` <code>(map: nil)</code> - Proxy configuration that's opaque to Nomad and
passed directly to Consul. See [Consul Connect's
2020-02-06 23:45:31 +00:00
documentation](https://www.consul.io/docs/connect/proxies/envoy#dynamic-configuration)
for details.
2019-09-05 18:08:31 +00:00
## `proxy` Examples
The following example is a proxy specification that includes upstreams configuration.
```hcl
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
2020-02-06 23:45:31 +00:00
[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'
[upstreams]: /docs/job-specification/upstreams 'Nomad upstream config Specification'
[port]: /docs/job-specification/network#port-parameters 'Nomad network port configuration'