Metrics not compatible with prometheus which is deployed using operator that has routePrefix in spec

Hi, the metrics does not show up in my case.

I think it is because the spec I use has routePrefix in it

kind: Prometheus
  name: monitor
  namespace: kube-prometheus-stack-prometheus
  routePrefix: /prometheus

I tried following metrics settings in cluster settings

PROMETHEUS: Prometheus Operator
PROMETHEUS SERVICE ADDRESS: monitor/kube-prometheus-stack-prometheus:9090/prometheus

and it is not working.

I got this in kube-api-server log, the requestURI is 404

    "kind": "Event",
    "apiVersion": "",
    "level": "RequestResponse",
    "auditID": "*****",
    "stage": "ResponseStarted",
    "requestURI": "/api/v1/namespaces/monitor/services/kube-prometheus-stack-prometheus:9090/proxy/api/v1/query_range",
    "verb": "create",
   "responseStatus": {
        "metadata": {},
        "code": 404

the correct URI should be


Hi, this is a known issue/feature request. We plan to add a configuration option to Metrics settings which would allow setting a prefix to the url. Currently there is no real workaround.

1 Like

Hi, could you try this service address:


this is assuming the service name is “monitor” - please adjust if it’s something else. It seems the namespace is kube-prometheus-stack-prometheus, not monitor.

Note that the input should be in form “namespace/service:port” but it should optionally accept a prefix.