- "--config.file=/etc/prometheus/prometheus.yml"
- "--storage.tsdb.path=/prometheus"
- "--storage.tsdb.retention=24h"
- "--web.enable-admin-api" #
控制对
admin HTTP API
的访问,其中包
括删除时间序列等功能
- "--web.enable-lifecycle" #
支持热更新,直接执行
localhost:9090/-/reload
立即生效
ports:
- containerPort: 9090
protocol: TCP
name: http
volumeMounts:
- mountPath: "/prometheus"
subPath: prometheus
name: data
- mountPath: "/etc/prometheus"
name: config-volume
resources:
requests:
cpu: 100m
memory: 512Mi
limits:
cpu: 100m
memory: 512Mi
securityContext:
runAsUser: 0
volumes:
- name: data
persistentVolumeClaim:
claimName: prometheus
- configMap:
name: prometheus-config
name: config-volume
#
我们在启动程序的时候,除了指定了
prometheus.yml
文件之外,还通过参数
storage.tsdb.path
指定了
TSDB
数据的存储路径、
#
通过
storage.tsdb.retention
设置了保留多长时间的数据,还有下面的
web.enable-admin-api
参数可以用来开启对
admin api
的访问权限,
#
参数
web.enable-lifecycle
非常重要,用来开启支持热更新的,有了这个参数之后,
prometheus.yml
配置文件只要更新了,
#
通过执行
localhost:9090/-/reload
就会立即生效,所以一定要加上这个参数。
评论