Hi there, I’m new to this forum. I’ve been having some struggles getting Nomad and Consul to work with upstreams. I’ve done a search on this forum and from what I can tell what I’ve done should be working. I’ve set up a simple project for testing, one service on a static port 3000 which sets service_b as an upstream on local port 8080.
For some reason I just cannot get this to work? All the health checks on Consul pass, I can curl the services using the ports given by Consul etc. I just cannot do curl localhost:3000/upstream
where the /upstream
endpoint is calling some endpoint on service B.
Service A nomad file:
job "job-a" {
datacenters = ["dc"]
type = "service"
group "service-a" {
network {
mode = "bridge"
port "service-a" {
to = 3000
static = 3000
}
}
service {
name = "service-a"
port = "service-a"
connect {
sidecar_service {
proxy {
upstreams {
destination_name = "service-b"
local_bind_port = 8080
}
}
}
}
check {
type = "http"
port = "service-a"
interval = "20s"
timeout = "20s"
path = "/status"
}
}
task "service-a" {
driver = "docker"
config {
image = "service_a:local"
ports = ["service-a"]
}
}
}
}
Service B nomad file:
job "job-b" {
datacenters = ["dc"]
type = "service"
group "service-b" {
network {
mode = "bridge"
port "service-b" {
to = 3000
}
}
service {
name = "service-b"
port = "service-b"
connect {
sidecar_service {}
}
check {
type = "http"
port = "service-b"
interval = "20s"
timeout = "20s"
path = "/status"
}
}
task "service-b" {
driver = "docker"
config {
image = "service_b:local"
ports = ["service-b"]
}
}
}
}
I’m sure there’s something very simple and obvious that I’ve missed here but so far I am still struggling and hoping someone can help. Thank you!