prometheus-es-exporter icon indicating copy to clipboard operation
prometheus-es-exporter copied to clipboard

Reload when config is updated

Open jackiepg12 opened this issue 6 years ago • 7 comments

How to reload when the config is updated?

jackiepg12 avatar Aug 23 '19 01:08 jackiepg12

Hi @jackiepg12, there's (currently) no support for reloading the config on the fly - either automatically or via a signal. The config is only read on startup, so if you need to modify it, you'll need to restart the exporter.

If you'd like to work on a config reload feature, I'd be happy to discuss how it might work?

braedon avatar Aug 26 '19 03:08 braedon

@jackiepg12 best way to reload the config is just redeploy the exporter or kill the pod. This is pretty common with many apps when it comes to initializing config at runtime.

jonny-wg2 avatar Jul 07 '20 12:07 jonny-wg2

@jackiepg12 if you use Kubernetes, maybe stakater-reloader can help you.

imcodybell avatar Sep 14 '20 08:09 imcodybell

+2 on stakater-reloader . we have this and it works great

jonny-wg2 avatar Dec 14 '20 16:12 jonny-wg2

@opsforce @jonny-wg2 Could you please give a example ?

xuanyuanaosheng avatar Jun 04 '21 05:06 xuanyuanaosheng

The reloader docs will help.

But here you go, with the configmap name being es-exporter

apiVersion: apps/v1
kind: Deployment
metadata:
  name: es-exporter
  namespace: monitoring
  annotations:
    configmap.reloader.stakater.com/reload: "es-exporter"
    flux.weave.works/automated: "true"
spec:

jonny-wg2 avatar Jun 04 '21 09:06 jonny-wg2

@braedon I think this definitely a plus. I had this requirement today, and had a look at the code. Shouldn't be too hard to implement, if I get around at learning how to reset the scheduler from scratch. I'm wondering if you have any thoughts on the best way forward?

Currently, this is what I'm doing:

  • I have an initContainer with kiwigrid/k8s-sidecar (quick reading through stakater-reloader doesn't seem to be able to save the files?) which will dump all relevant configmaps into a folder (config-dir);
  • Then the prometheus-es-exporter starts, and it will handle errors via PR #98
  • Together with the exporter, I keep a sidecar (also kiwigrid/k8s-sidecar) monitoring for changes, and when there are changes, it triggers a pod restart;

So far, seems to work well.... but it's definitely more convoluted than a simple SIGHUP or dnotify...

ntavares avatar Jan 06 '22 00:01 ntavares