0

I'm trying to add basic authentication for prometheus pod but when I deploy the pod with the below config I get the error: "Readiness probe failed: HTTP probe failed with statuscode: 401", I saw that this is a problem with "configuring the basic authentication" but maybe someone succeeded.

I've followed the prometheus tutorial from their webiste but without luck.

enter image description here

My deploymentconfig

- kind: ConfigMap
    apiVersion: v1
    metadata:
      name: prometheus-config
    data:
      prometheus.yml: |-
        global:
          scrape_interval: 30s
          scrape_timeout: 10s
          evaluation_interval: 10s
          external_labels:'
            type: 'kubernetes'
          .................etc
      web.yml: |-
        basic_auth_users:
            admin: fsdsdfsdfdsfdsft565tfg45wasfsdgfddggs
- kind: DeploymentConfig
    apiVersion: v1
    metadata:
      generation: 1
      labels:
        app: tools
      name: prometheus
    spec:
      replicas: 1
      revisionHistoryLimit: 3
      selector:
          affinity:
            podAntiAffinity:
          containers:
            - args:
                - '--storage.tsdb.retention.size=7GB'
                - '--storage.tsdb.path=/prometheus'
                - '--config.file=/etc/prometheus/prometheus.yml'
                - '--web.config.file=/etc/prometheus/web.yml'
                - '--web.enable-lifecycle'
              command:
                - /bin/prometheus

..................... etc

The pod is starting well with the args "--web.config.file=/etc/prometheus/web.yml" added in the deployment but the issue is that when basic authentication is enabled on endpoints used for liveness and readiness probes, resulting in the pod being killed. Other fact is when I'm trying to "curl -s -u admin htt://localhost:9090/metrics", it ask me for password and the is not showing anything.

1
  • Just a rule of thumb, if your healthcheck requires auth like http basic, you'll need to swap out your HTTP healthchecks for exec ones that call curl/wget.
    – jordanm
    May 3 at 1:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.