Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loki gateway cannot be scraped by prometheus when basicAuth is enabled #14141

Open
adippl opened this issue Sep 15, 2024 · 1 comment
Open

Loki gateway cannot be scraped by prometheus when basicAuth is enabled #14141

adippl opened this issue Sep 15, 2024 · 1 comment

Comments

@adippl
Copy link

adippl commented Sep 15, 2024

Describe the bug
Prometheus cannot collect logs from loki-gateway when authentication is enabled.

To Reproduce
Steps to reproduce the behavior:

  1. Install loki 6.10.0 from helm
  2. Enable monitoring and basicAuth
gateway:
  enabled: true
  basicAuth:
    enabled: true
monitoring:
  dashboards:
    enabled: true
  rules:
    enabled: true
    labels:
      prometheus: main    
  serviceMonitor:
    enabled: true
    labels:
      prometheus: main
  1. Prometheus servicemonitor is created but prometheus cannot scrape gateway because of authorization. Error 401
    Image
    (All other targets created by this servicemonitor are scraped correctly)

Expected behavior
Servicemonitor should configure prometheus to use some authorization or gateway should be scraped via some non authenticated port.

Environment:

  • Infrastructure: Kubernetes, kvm virtual machines
  • Deployment tool: argocd
@dominikdeichsel
Copy link

Quick Workaround:

  1. Add nginx-prometheus-exporter as described here:
    Loki gateway metrics (Nginx) #9522 (comment)

  2. Deactivate basic_auth for the /metrics URL via

gateway:
  nginxConfig:
    serverSnippet: |
      location = /stub_status {
        stub_status on;
        auth_basic off;
        allow 127.0.0.1;
        deny all;
      }
      location = /metrics {
        proxy_pass       http://127.0.0.1:9113/metrics;
        auth_basic off;
      }

Loki Helm Chart does not implement basic auth configuration for the ServiceMonitor (tested with Helm Chart 6.12.0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants