0

I am trying to use oauth2 in the kube-prom-stack for the authetication for metrics federate from a https node. Below is my configuration:

`additionalScrapeConfigs:
      - job_name: 'test-federation'
        scrape_interval: 20s
        scrape_timeout: 20s
        scheme: https
        oauth2:
          client_id: 'auth-server'
          client_secret: 'XXXXXXXXXXX'
          token_url: 'http://XXX.XXX.XX.XX:80/auth/token '
          endpoint_params:
            grant_type: 'client_credentials'
        metrics_path: /federate
        honor_labels: true
        tls_config:
          insecure_skip_verify: true
        metric_relabel_configs:
          - source_labels: [id]
            regex: '^static-agent$'
            action: drop
        params:
          match[]:
            - '{job="xyz"}'
        static_configs:
          - targets: ['XXX.XX.XX.XX:9090']`

But, when i checked my prometheus tarhgets i see below error:

oauth2: cannot fetch token: 400 Bad Request Response: {"code":"400","description":"Invalid credentials"} Please help.

oauth2:
          client_id: 'auth-server'
          client_secret: 'XXXXXXXXXXX'
          token_url: 'http://XXX.XXX.XX.XX:80/auth/token '
          endpoint_params:
            grant_type: 'client_credentials'

I tried the above for Oauth2 authentication, but i see the below error in prometheues targets while scraping metrics from other node.

oauth2: cannot fetch token: 400 Bad Request Response: {"code":"400","description":"Invalid credentials"}

0 Answers0