open-nomad/website/source/docs/job-specification/proxy.html.md
Tim Gross cd9c23617f
client/connect: ConsulProxy LocalServicePort/Address (#6358)
Without a `LocalServicePort`, Connect services will try to use the
mapped port even when delivering traffic locally. A user can override
this behavior by pinning the port value in the `service` stanza but
this prevents us from using the Consul service name to reach the
service.

This commits configures the Consul proxy with its `LocalServicePort`
and `LocalServiceAddress` fields.
2019-09-23 14:30:48 -04:00

2.7 KiB

layout page_title sidebar_current description
docs proxy Stanza - Job Specification docs-job-specification-proxy The "proxy" stanza allows specifying options for configuring sidecar proxies used in Consul Connect integration

proxy Stanza

Placement job -> group -> service -> connect -> sidecar_service -> **proxy**

The proxy stanza allows configuring various options for the sidecar proxy managed by Nomad for Consul Connect. It is valid only within the context of a sidecar_service stanza.

 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 (int:port) - The port the local service binds to. Usually the same as the parent service's port, it is useful to customize in clusters with mixed Connect and non-Connect services
  • upstreams (upstreams: nil) - Used to configure details of each upstream service that this sidecar proxy communicates with.
  • config (map: nil) - Proxy configuration that's opaque to Nomad and passed directly to Consul. See Consul Connect's documentation for details.

proxy Examples

The following example is a proxy specification that includes upstreams configuration.

   sidecar_service {
     proxy {
       upstreams {
         destination_name = "count-api"
         local_bind_port = 8080
       }
     }
   }