On nomad’s host are’n opened port 9001 I need metrics from only envoy, but not service, envoy does’not registered on consul. if I understand correctly, envoy will`not register on consul. But, in nomad i watch envoy like separate container:
Can i get metrics from envoy but not from service?
I had a typo that you copied, it should be “${NOMAD_HOST_PORT_metrics_envoy}” (single dollar). Might be the problem
Explanation:
“port “metrics_envoy” {to = 9102}” maps a named port to port 9102 in the network-bridge for the deployment group & exposes as a dynamic port on the host.
"metrics_port_envoy = “${NOMAD_HOST_PORT_metrics_envoy}” sets a value you can lookup in the prometheus-job (metrics_port_envoy) and maps the value to the value of the dynamic port assigned in previous step (will change w/each deployment).
"envoy_prometheus_bind_addr = “0.0.0.0:9102” configures prometheus for the envoy-task itself to bind on 9102 on the network-bridge. See Consul documentation.
In Prometheus, you lookup the consul parameter from step 2 to read the host & port for the exported envoy metrics target.
EDIT: You should also be able to access the dynamic port from step 1 on the host directly (http://<host-ip>:<dynamic-port>/metrics) to check if it works. Nomad will display the assigned port in the UI after deployment. I see yo are scraping port 9001, which is not the envoy metrics port, but the service-port, so I think you didn’t use the prometheus config I showed
Thanks @runeron and @IvanNazarenko for the open discussion and solution for this issue, this helped me out so much and I was almost convinced that this feature was supported only in k8s. But I’ve got it working now too!