參考官方文件的教學如下:
https://prometheus.io/docs/prometheus/latest/configuration/configuration/
Prometheus can reload its configuration at runtime. If the new configuration is not well-formed, the changes will not be applied. A configuration reload is triggered by sending a SIGHUP to the Prometheus process or sending a HTTP POST request to the /-/reload endpoint (when the –web.enable-lifecycle flag is enabled). This will also reload any configured rule files.
而實際的應用方式則是:
- 第一種,向prometheus進行發信號
kill -HUP pid - 第二種,向prometheus發送HTTP請求
curl -XPOST http://127.0.0.1:9090/-/reload
但是會需要先設定--web.enable-lifecycle
參數template: metadata: labels: ... prometheus: rancher-monitoring-prometheus spec: containers: - args: - --web.enable-lifecycle image: rancher/mirrored-prometheus-prometheus:v2.27.1 imagePullPolicy: IfNotPresent name: prometheus ....