<p>I'm trying to setup a Prometheus monitoring on a dedicated Linux VM to get Kubernetes cluster metrics.</p>

<p>Whatever I try, I'm always blocked with the nice message Unauthorized...</p>

<p>This is my scrape config for pods: </p>

<pre><code>- job_name: 'Kubernetes'
scheme: https
tls_config:
  insecure_skip_verify: true
bearer_token: %VeryLongLine%
kubernetes_sd_configs:
- api_server: https://%ClusterName%.hcp.westeurope.azmk8s.io
  tls_config:
    insecure_skip_verify: true
  role: node
  namespaces:
    names: [default]
</code></pre>

<p>The token is the correct one because a Invoke-WebRequest from PowerShell works just fine.</p>

<p>Does anyone have an idea? </p>

<p>Thank you</p>

KAMI
<pre><code>- job_name: 'Kubernetes'
  scheme: https
  tls_config:
   insecure_skip_verify: true
  kubernetes_sd_configs:
  - api_server: https://%ClusterName%.hcp.westeurope.azmk8s.io
    bearer_token: %VeryLongLine%
    role: node
    namespaces:
      names: [default]
</code></pre>

<p>Bearer token at the right place, so in the kubernetes config and not the job</p>
