promlens icon indicating copy to clipboard operation
promlens copied to clipboard

Prometheus with Basic Auth

Open benjaminguttmann-avtq opened this issue 2 years ago • 5 comments

Currently Promlens does not support if Prometheus is protected via basic auth, would be great if that could be added.

benjaminguttmann-avtq avatar Oct 27 '22 09:10 benjaminguttmann-avtq

+1. Would love to see either Basic Auth working with PromLens or PromLens incorporated into the Prometheus Web UI as an additional option.

avdicl avatar Dec 29 '22 01:12 avdicl

Hey, same issue here!

I am hosting PromLens on Kubernetes and I used a workaround this way:

  • Promlens is hosted in same namespace than Prometheus
  • I declared two ingress ressources:
  1. One to Promlens service
  2. Another one, on same hostname, which is a proxy to prometheus service. This way, prometheus api is served on same hostname and on prefix: /prometheus
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/auth-url: http://nginx-ldap-auth.kube-system.svc.cluster.local:5555 # our basic-auth system
  name: promlens
  namespace: monitoring
spec:
  ingressClassName: ingress-private
  rules:
  - host: promlens.myfqdn
    http:
      paths:
      - backend:
          service:
            name: promlens
            port:
              number: 8080
        path: /
        pathType: Prefix
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/auth-url: http://nginx-ldap-auth.kube-system.svc.cluster.local:5555
    nginx.ingress.kubernetes.io/rewrite-target: /$2
  name: promlens-to-prometheus
  namespace: monitoring
spec:
  ingressClassName: ingress-private
  rules:
  - host: promlens.myfqdn
    http:
      paths:
      - backend:
          service:
            name: prometheus-prometheus
            port:
              number: 9090
        path: /prometheus(/|$)(.*)
        pathType: Prefix

Thanks for this awesome tool! :)

Monpoke avatar Jan 03 '23 17:01 Monpoke

I just found another nice workaround. Just use --grafana.url. Then Grafana will handle basic auth. PromLens even says this in the logs:

promlens_1  | 2023/01/31 18:27:46 Proxying to Grafana at /api/datasources/proxy/92/api/v1/query...

Cheers :)

ypid-work avatar Jan 31 '23 18:01 ypid-work

I just found another nice workaround. Just use --grafana.url. Then Grafana will handle basic auth. PromLens even says this in the logs:

promlens_1  | 2023/01/31 18:27:46 Proxying to Grafana at /api/datasources/proxy/92/api/v1/query...

Cheers :)

I have a grafana behind TLS but SSL certificate is not valid. Is there a way to disable it ?

tls_skip_verify_insecure maybe ? but where.

omerfsen avatar Feb 17 '23 11:02 omerfsen

I added support for Basic Auth in this Fork (https://github.com/glidea/promlens), and a 'datasource' manager (https://github.com/glidea/promlens-datasource-manager)

glidea avatar Jul 15 '23 15:07 glidea