Running Prometheus on Kubernetes

Up until now, we have configured all scraping targets for Prometheus manually by adding them to the prometheus.yml configuration file. This works well for testing, but becomes tedious quickly in larger production setups (and completely pointless as soon as you introduce feature such as autoscaling).

When running your application within a Kubernetes cluster, Prometheus offers a turn-key solution for this—using the prometheus.yml configuration file, you can actually configure Prometheus to automatically load its scraping targets from the Kubernetes API. For example, if you have a Deployment defined for your booking service, Prometheus can automatically find all Pods that are managed by this Deployment and scrape ...

Get Cloud Native programming with Golang now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.