Mesh network - Upstream configuration

Hi,

I would like experiment Mesh network with Nomad/Consul. I have implemented a simple use case but I have some issues with it. The use case is a simple API rest transaction between a front/backend where the front prints a string obtained via a request to the back’s endpoint /health.

Configuration:

  • Frontend:

    • Bind on: 0.0.0.0:3000
    • Backend: 127.0.0.1:7000
  • Backend:

    • Bind on: 0.0.0.0:8080

Nomad job: (Very similar to the tutorial Consul Service Mesh | Nomad by HashiCorp)

job "myjob" {
  datacenters = ["MicroservicePlatform"]

  group "api" {
    network {
      mode = "bridge"
    }

    service {
      name = "bapi"
      port = 8080

      connect {
        sidecar_service {}
      }
    }

    task "web" {
      driver = "docker"

      config {
        image = "REGISTRY/backend"
      }
    }
  }

  group "front" {
    network {
      mode = "bridge"

      port "http" {
        static = 3000
        to     = 3000
      }
    }

    service {
      name = "bfront"
      port = "http"

      connect {
        sidecar_service {
          proxy {
            upstreams {
              destination_name = "bapi"
              local_bind_port  = 7000
            }
          }
        }
      }
    }

    task "dashboard" {
      driver = "docker"

      config {
        image = "REGISTRY/frontend"
      }
    }
  }
}

The front is correctly accessible but the Api request to the backend does not work. From the browser debugger, I have the request http://localhost:3000/127.0.0.1:7000/health that gets a 404 not found… In my mind, this config file inits an envoy proxy for the backend and an other in the network namespace of the front that will bind the backend service to 127.0.0.1:7000. I have allowed the intention to from bfront to bapi .

I’m new with Mesh network so I have probably misunderstanded something. Where have i done an error ?

Thanks for your help !

Fix: It was a problem from my front.

  • 127.0.0.1 → localhost
1 Like

Sorry we didn’t reply sooner @soyin63599, but glad you got it worked out!