I’m running Consul + Nomad with Connect sidecars. I have a Nomad job like this (simplified):
service {
name = "bar"
port = 9090
meta {
envoy_metrics_port = "${NOMAD_HOST_PORT_envoy_metrics}"
}
connect {
sidecar_service {
proxy {
config {
envoy_prometheus_bind_addr = "0.0.0.0:9102"
}
transparent_proxy {
no_dns = true
}
}
}
}
}
Without the transparent_proxy block, Prometheus can scrape http://<node-ip>:<dynamic-port>/metrics correctly.
Once I enable transparent_proxy { no_dns = true }, Prometheus fails with:
Error scraping target: Get “``http://10.0.x.x:23139/metrics”:`` EOF
Prometheus itself is also running in Nomad with transparent_proxy enabled.
I have intentions set up to allow Prometheus → bar.
Question:
Does transparent_proxy mode currently support scraping Envoy proxy metrics (via envoy_prometheus_bind_addr)?
If not, what’s the recommended way to expose Envoy/sidecar metrics when using transparent proxy? Should these metrics be scraped via the sidecar service through Consul DNS instead of the host IP/port?
@Material-Scientist
Initially, I was using multiple port configurations in my Nomad job like this:
network {
mode = "bridge"
port "http" {
to = 9090
}
port "envoy_metrics" {
to = 9102
}
}
When I removed the http port configuration and instead added the expose configuration (as shown in your example), Prometheus started scraping the Envoy metrics correctly.