Reload when config is updated
How to reload when the config is updated?
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?
@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.
@jackiepg12 if you use Kubernetes, maybe stakater-reloader can help you.
+2 on stakater-reloader . we have this and it works great
@opsforce @jonny-wg2 Could you please give a example ?
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:
@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...