I’m running both Homeassistant and Prometheus on a kubernetes cluster. I have setup a long lived access token and enabled the prometheus integration in the config file (prometheus:) If I execute curl with this token, I get the expected outcome;
I can see the target in Prometheus, but it is DOWN with the error ‘server returned HTTP status 401 Unauthorized’. In Homeassistant, I see a ‘Login attempt or request with invalid authentication’ every 30s.
I guess you’ll need to read up on how to store and retrieve secrets in k8s. The key field value should correspond with a stored secret name in k8s secrets store.
I personally find k8s a huge overkill, I run my set up in a Hashicorp Nomad cluster with prometheus etcetera. Metrics and such work perfectly with the use of a token. This should also work perfectly in k8s. But have a look at https://kubernetes.io/docs/concepts/configuration/secret/ for reading up on how to use secrets in k8s.