0

I have deployed prometheus blackbox-exporter on kubernetes and accessing it with ingress url as a subpath, blackbox exporter UI is opening but when click on any link in the ui it is redirecting but not showing any value example the metrics.

ingress.yaml

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress-blackbox
  namespace: test
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
  ingressClassName: nginx
  rules:
  - host: example.com
    http:
      paths:
      - backend:
         service:
            name: prometheus-blackbox-exporter
            port:
              number: 9115
        path: /blackbox/(.*)
        pathType: Prefix

I am opening the black box exporter ui on https://example.com/blackbox/ but when I click on any other link it is redirecting but not giving any value

SVD
  • 385
  • 4
  • 24

1 Answers1

0

Please update the below lines in the ingress.yaml file instead of path: /blackbox/(.*)

path: /blackbox(/|$)(.*)
pathType: Prefix

The characters captured by (.*) will be assigned to the placeholder $1, which is used as a parameter in the rewrite-target annotation.

For example, the ingress definition above will result in the following rewrites:

example/blackbox/ rewrites to example.com/
example.com/blackbox/new rewrites to example.com/new

Please follow the documentation [1] for reference.

[1] https://kubernetes.github.io/ingress-nginx/examples/rewrite/