»sidecar_service Stanza

Placementjob -> group -> service -> connect -> sidecar_service

The sidecar_service stanza allows configuring various options for the sidecar proxy managed by Nomad for Consul Connect integration. It is valid only within the context of a connect 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 = "hashicorpnomad/counter-api:v3"
      }
    }
  }
}
job "countdash" {  datacenters = ["dc1"]
  group "api" {    network {      mode = "bridge"    }
    service {      name = "count-api"      port = "9001"
      connect {        sidecar_service {}      }    }
    task "web" {      driver = "docker"
      config {        image = "hashicorpnomad/counter-api:v3"      }    }  }}

»sidecar_service Parameters

  • disable_default_tcp_check (bool: false) - disable the default TCP health check.

  • port (string: ) - Port label for sidecar service.

  • proxy (proxy: nil) - This is used to configure the sidecar proxy service.

  • tags (array<string>: nil) - Custom Consul service tags for the sidecar service.

»sidecar_service Examples

The following example is a minimal sidecar_service stanza with defaults

  connect {
    sidecar_service {}
  }
  connect {    sidecar_service {}  }

The following example includes specifying upstreams.

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

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