helm-charts icon indicating copy to clipboard operation
helm-charts copied to clipboard

[prometheus] scrapeconfig k8s secrets supported?

Open r0b1ndot opened this issue 1 year ago • 12 comments

recommended way of using a k8s secret containing username and password for the basic auth for a backend defined in scrape_config

Hi, i want to use an existing k8s secret for the scrape config.

here i have a service which requires basic auth. i found a way to have the secret local as file available but sadly there is no direct way to define a file for username in the scrape_config

  extraSecretMounts:
      - name: service-auth-secret
        mountPath: /etc/prometheus/auth
        secretName: service-auth-secret
        readOnly: true

with that i have local the files: /etc/prometheus/auth/username and password containing in separate files.
also via the env variable it didn't work since the template then requires envsubst.

 scrape_configs:
    - job_name: service01
      tls_config:
        insecure_skip_verify: true
      scheme: http
      scrape_interval: 120s
      scrape_timeout: 30s
      honor_labels: true
      metrics_path: metrics
      basic_auth:
        username: foo
        password: bar
      static_configs:
        - targets: ['fancyservice.local']
        

so whats the official recommended way of dealing with basic auth settings via kubernetes secrets?

What's your helm version?

v3.11.2

What's your kubectl version?

1.23

Which chart?

prometheus

What's the chart version?

14.6.0

What happened?

No response

What you expected to happen?

No response

How to reproduce it?

No response

Enter the changed values of values.yaml?

No response

Enter the command that you execute and failing/misfunctioning.

/

Anything else we need to know?

No response

r0b1ndot avatar Apr 06 '23 12:04 r0b1ndot