Reloader icon indicating copy to clipboard operation
Reloader copied to clipboard

Prometheus reloading

Open hholst80 opened this issue 4 years ago • 3 comments

I have deployed VictoraMetrics (promethus compatible) as a Deployment with replicas=1 and I would like to reload Prometheus using Stakater/Reloader. The problem I am running into is that VictoraMetrics will not allow the database to be re-allocated to a new pod while the old pod is still running. I cannot see a way to redeploy VM using this process, but rather I would in this case employ some kind of process signaling to reload the configuration. Is that something that Reloader can support directly or indirectly?

...
prometheus-5cf78d6949-qnpt5          1/1     Running            0          21h
prometheus-697ddcbfd9-lrll2          0/1     CrashLoopBackOff   3          84s

https://www.robustperception.io/reloading-prometheus-configuration

hholst80 avatar Mar 20 '21 18:03 hholst80

Currently, the reloader does not have such functionality to signal the change towards the container directly. Reloader interacts with the parent resource of the pod (Deployment, Statefulset, etc.) to reload the pod. But we welcome PRs for all the enhancements :)

faizanahmad055 avatar Mar 22 '21 10:03 faizanahmad055

For anyone facing the same issue this looks promising: https://www.weave.works/blog/prometheus-configmaps-continuous-deployment/

hholst80 avatar Mar 23 '21 18:03 hholst80

Prometheus has embedded config reload. I use a sidecar container with https://hub.docker.com/r/jimmidyson/configmap-reload that calls /-/reload on prometheus whenever the configmap gets updated

      - name: config-autoreload
        image: docker.io/jimmidyson/configmap-reload
        args:
        - --volume-dir=/etc/prometheus/config
        - --webhook-url=http://localhost:9090/-/reload
        volumeMounts:
        - name: conf
          mountPath: /etc/prometheus/config
          readOnly: true

(you must add --web.enable-lifecycle to prometheus startup args).

I run Victoria with no configuration file, the scraping is done by a separate vmagent deployment, that automatically reloads the prometheus scrape configuration if -promscrape.configCheckInterval=5m is enabled.

Feder1co5oave avatar Jun 18 '21 11:06 Feder1co5oave