I’ve set up a Nomad & Consul cluster with 2 nodes. Node1 is server and leader for Consul and Nomad, and Node2 runs the clients for both too. Nomad is running as user “root” and Consul is running as user “consul” in both nodes.
This is my job spec:
job "grafana" {
datacenters = ["lan"]
type = "service"
namespace = "monitoring"
group "grafana" {
count = 1
service {
name = "grafana"
port = "http"
tags = ["monitoring", "prometheus", "urlprefix-/grafana strip=/grafana"] //TODO: does not work
check {
name = "Grafana HTTP alive"
type = "http"
path = "/api/health"
interval = "5s"
timeout = "2s"
check_restart {
limit = 2
grace = "60s"
ignore_warnings = false
}
}
connect {
sidecar_service {
tags = ["connect-proxy"]
proxy {
upstreams {
destination_name = "prometheus"
local_bind_port = 4444
}
expose {
path {
path = "/"
protocol = "http"
local_path_port = 3000
listener_port = "http"
}
}
}
}
}
}
network {
mode = "bridge"
port "http" {
static = 3000
}
}
restart {
attempts = 3
delay = "20s"
mode = "delay"
}
task "grafana" {
driver = "docker"
config {
image = "grafana/grafana-enterprise"
ports = ["http"]
volumes = [
"/srv/master-volume/${NOMAD_JOB_NAME}/grafana-storage:/var/lib/grafana"
]
}
}
}
}
When I try to run the task with this connect_block, Grafana starts correctly but for the proxy task I get the following error: