Hi!
I have a Kubernetes/Prometeus newbie question.
I have a Kubernetes application that I want to scale up via Horizontal Pod Autoscaler based on custom metrics reflecting the length of the app's work queue backlog in the app's internal database.
I can expose the metrics on a pod port in Prometheus format, so there is more than one scrape endpoint for fail-over purposes. However I do not want Prometheus to call the scrape endpoint on every pod's instance, only one instance at a time and failover to another instance only if necessary. All instance endpoints report the same data, and calling them in parallel would serve no useful purpose and only increase a workload on storage queries behind the app runtime.
Right now the application is packaged as a Kubernetes Deployment. Do I need to convert it for the above as a Service, or can Prometeus understand intrinsically or be instructed in the configuration that only one instance is to be called at a time?
Also, can someone please provide an example of the snippet I need to insert into
so Prometheus picks up the endpoint? Assuming, for example, it is exposed on pod port 3333, path /metrics, service/pod named ABC or with label appname=LABC?
Or do I simply tag the pod/service/deployment with some tag and Prometeus starts to collect on it? If yes, how do I pack the endpoint port+protocol+path into the tag?
Thanks for the advice.