Automatically setting the Prometheus endpoint for KOTS

Had a Slack chat with one of our software vendors this morning about setting the Prometheus endpoint for KOTS. Unfortunately we don’t expose that in a documented way, since we’re assuming it’s something that either you’re providing automatically with kURL or your customer knows and you don’t.

The question from the vendor this morning was about installing Prometheus themselves and wanting to set the value. Generally I’d advise against installing infrastructure like prom, but in this case it’s a dedicated cluster (specifically using the new Embedded Cluster). I took a look into the source for KOTS and found an answer in the endpoints it exposes. I found one that seemed to fit the trick and gave it a try. It worked.

I created a gist for a Kubernetes job that sets the value. Remember that this job uses an endpoint that is not part of a documented and supported API. That means it’s subject to change without notice. With that caveat, this should do what you need if you’re looking to automatically set the Prometheus endpoint for KOTS.