prometheus-adapter icon indicating copy to clipboard operation
prometheus-adapter copied to clipboard

Guide to use basic auth for prometheus adapter to VM

Open Maag2510 opened this issue 2 years ago • 6 comments

We are trying to connect prometheus adapter to external VM using basic auth but unable to to do. We used TLS certificate headers and for authentication we tried to use args like '--prometheus-header=Authorization=Basic cHJvbWV0aGV1czpwcm9tZXRoZXVz' where cHJvbWV0aGV1czpwcm9tZXRoZXVz is Base64 value for our username:password. While establishing connection we see errors like Bad Response, invalid character 'c'.

Please advise correct way to use basic auth in prometheus adapter.

Maag2510 avatar Mar 23 '23 07:03 Maag2510

/triage accepted /kind support

logicalhan avatar Mar 23 '23 16:03 logicalhan

/assign @dgrisonnet

logicalhan avatar Mar 23 '23 16:03 logicalhan

Hi @Maag2510 , could you perhaps try with: --prometheus-header="Authorization=Basic cHJvbWV0aGV1czpwcm9tZXRoZXVz"

dgrisonnet avatar Mar 23 '23 17:03 dgrisonnet

hi @dgrisonnet , we tried the above approach but in this case getting the error like

net/http: invalid header field name ""Authorization"

I also tried --prometheus-header=Authorization "Basic cHJvbWV0aGV1czpwcm9tZXRoZXVz" but same bad response. Please suggest correct way to use auth header.

Maag2510 avatar Apr 10 '23 09:04 Maag2510

@Maag2510 you can try with : --prometheus-header=Authorization=Basic cHJvbWV0aGV1czpwcm9tZXRoZXVz . It works normally in my environment. Note: Do not have double quotes.

zypln avatar Jul 24 '23 01:07 zypln

This issue has not been updated in over 1 year, and should be re-triaged.

You can:

  • Confirm that this issue is still relevant with /triage accepted (org members only)
  • Close this issue with /close

For more details on the triage process, see https://www.kubernetes.dev/docs/guide/issue-triage/

/remove-triage accepted

k8s-triage-robot avatar Jul 23 '24 02:07 k8s-triage-robot