title: Unable to get Consul Connect to work with Nomad
body: <p>I'm trying to get Consul Connect side car envoy to work but the health checks for sidecar keeps failing.</p>
  
  <p>I'm using following versions of Consul and Nomad</p>
  
  <pre><code>Consul : 1.7.3
  Nomad : 0.11.1
  CNI Plugins : 0.8.6
  </code></pre>
  
  <p>My setup looks like follows.</p>
  
  <p><strong>1 Consul Server running consul in docker container.</strong></p>
  
  <pre><code>docker run -d --net=host --name=server -v /var/consul/:/consul/config consul:1.7 agent -server -ui -node=server-1 -bind=$internal_ip -ui -bootstrap-expect=1 -client=0.0.0.0
  </code></pre>
  
  <p><code>internal_ip</code> is the internal IP address of my GCP VM.</p>
  
  <p><strong>1 Nomad Server with Consul Agent in client mode</strong></p>
  
  <pre><code>nohup nomad agent -config=/etc/nomad.d/server.hcl &amp;
  
  docker run -d --name=consul-client --net=host -v ${volume_path}:/consul/config/ consul:1.7 agent -node=$node_name -bind=$internal_ip -join=${server_ip} -client=0.0.0.0
  </code></pre>
  
  <p><code>interal_ip</code> is the internal IP address of GCP VM and <code>server_ip</code> is the internal IP address of Server VM.</p>
  
  <p><strong>2 Nomad Client with Consul Agent in client mode</strong></p>
  
  <pre><code>nohup nomad agent -config=/etc/nomad.d/client.hcl &amp;
  
   docker run -d --name=consul-client --net=host -v ${volume_path}:/consul/config/ consul:1.7 agent -node=$node_name -bind=$internal_ip -join=${server_ip} -client=0.0.0.0
  </code></pre>
  
  <p><strong>On Nomad clients, I also have <code>consul</code> binary available in path.</strong></p>
  
  <p>Now I'm trying to deploy the sample Nomad and Consul Connect job from <a href="https://www.nomadproject.io/docs/integrations/consul-connect/" rel="nofollow noreferrer">here</a></p>
  
  <pre><code>    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:v1"
            }
          }
        }
  
        group "dashboard" {
          network {
            mode = "bridge"
  
            port "http" {
              static = 9002
              to     = 9002
            }
          }
  
          service {
            name = "count-dashboard"
            port = "9002"
  
            connect {
              sidecar_service {
                proxy {
                  upstreams {
                    destination_name = "count-api"
                    local_bind_port  = 8080
                  }
                }
              }
            }
          }
  
          task "dashboard" {
            driver = "docker"
  
            env {
              COUNTING_SERVICE_URL = "http://${NOMAD_UPSTREAM_ADDR_count_api}"
            }
  
            config {
              image = "hashicorpnomad/counter-dashboard:v1"
            }
          }
        }
      }
  </code></pre>
  
  <p>The docker container for service and sidecar gets started and gets registered in Consul, but I'm unable to access any of the service. </p>
  
  <p><a href="https://i.stack.imgur.com/a0GNj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/a0GNj.png" alt="enter image description here"></a></p>
  
  <p>I SSH onto the Nomad Client node and can see the container running.</p>
  
  <p><a href="https://i.stack.imgur.com/S55MU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/S55MU.png" alt="enter image description here"></a></p>
  
  <ol>
  <li>Odd thing I noticed is that I cannot see port forwarded to the host</li>
  <li>I cannot access it via curl from host.</li>
  </ol>
  
  <p>I tried doing <code>curl $internal_ip:9002</code> but it didn't work. </p>
  
  <p>I checked if Nomad created any new bridge network since that's what I used as <code>mode</code> in the <code>network stanza</code> but there are no new networks.</p>
  
  <p><a href="https://i.stack.imgur.com/TN26L.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TN26L.png" alt="enter image description here"></a></p>
  
  <p>Is there anything that I'm missing in my setup ? </p>