github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/website/content/docs/job-specification/proxy.mdx (about)

     1  ---
     2  layout: docs
     3  page_title: proxy Stanza - Job Specification
     4  description: |-
     5    The "proxy" stanza allows specifying options for configuring
     6    sidecar proxies used in Consul Connect integration
     7  ---
     8  
     9  # `proxy` Stanza
    10  
    11  <Placement
    12    groups={['job', 'group', 'service', 'connect', 'sidecar_service', 'proxy']}
    13  />
    14  
    15  The `proxy` stanza allows configuring various options for the sidecar proxy
    16  managed by Nomad for [Consul
    17  Connect](/docs/integrations/consul-connect). It is valid only
    18  within the context of a `sidecar_service` stanza.
    19  
    20  ```hcl
    21  job "countdash" {
    22    datacenters = ["dc1"]
    23  
    24    group "api" {
    25      network {
    26        mode = "bridge"
    27      }
    28  
    29      service {
    30        name = "count-api"
    31        port = "9001"
    32  
    33        connect {
    34          sidecar_service {
    35            proxy {}
    36          }
    37        }
    38      }
    39  
    40      task "web" {
    41        driver = "docker"
    42  
    43        config {
    44          image = "hashicorpdev/counter-api:v3"
    45        }
    46      }
    47    }
    48  }
    49  ```
    50  
    51  ## `proxy` Parameters
    52  
    53  - `local_service_address` `(string: "127.0.0.1")` - The address the local service binds to. Useful to
    54    customize in clusters with mixed Connect and non-Connect services.
    55  - `local_service_port` `(int: <varies>)` - The port the local service binds to.
    56    Usually the same as the parent service's port, it is useful to customize in clusters with mixed
    57    Connect and non-Connect services.
    58  - `upstreams` <code>([upstreams][]: nil)</code> - Used to configure details of each upstream service that
    59    this sidecar proxy communicates with.
    60  - `expose` <code>([expose]: nil)</code> - Used to configure expose path configuration for Envoy.
    61    See Consul's [Expose Paths Configuration Reference](https://developer.hashicorp.com/consul/docs/connect/registration/service-registration#expose-paths-configuration-reference)
    62    for more information.
    63  - `config` `(map: nil)` - Proxy configuration that's opaque to Nomad and
    64    passed directly to Consul. See [Consul Connect's
    65    documentation](https://developer.hashicorp.com/consul/docs/connect/proxies/envoy#dynamic-configuration)
    66    for details. Keys and values support [runtime variable interpolation][interpolation].
    67  
    68  ## `proxy` Examples
    69  
    70  The following example is a proxy specification that includes upstreams configuration.
    71  
    72  ```hcl
    73  sidecar_service {
    74    proxy {
    75      upstreams {
    76        destination_name = "count-api"
    77        local_bind_port  = 8080
    78      }
    79    }
    80  }
    81  ```
    82  
    83  [job]: /docs/job-specification/job 'Nomad job Job Specification'
    84  [group]: /docs/job-specification/group 'Nomad group Job Specification'
    85  [task]: /docs/job-specification/task 'Nomad task Job Specification'
    86  [interpolation]: /docs/runtime/interpolation 'Nomad interpolation'
    87  [sidecar_service]: /docs/job-specification/sidecar_service 'Nomad sidecar service Specification'
    88  [upstreams]: /docs/job-specification/upstreams 'Nomad upstream config Specification'
    89  [expose]: /docs/job-specification/expose 'Nomad proxy expose configuration'