How to update Prometheus config in k8s cluster How to update Prometheus config in k8s cluster kubernetes kubernetes

How to update Prometheus config in k8s cluster


The recommended way is to provide the prometheus.yml via a ConfigMap. That way changes in the ConfigMap will be propagated into the pod that consumes the configMap. However, that is not enough for prometheus to pick up the new config.

Prometheus supports runtime reload of the config, so that you don't need to stop prometheus in order to pickup the new config. You can either do that manually by sending a POST request as described in the link above, or automate this process by having a sidecar container inside the same prometheus pod that watch for updates to the config file and does the reload POST request.

The following is an example on the second approach: prometheus-configmaps-continuous-deployment