如何在Prometheus-operator中启用持久性 [英] How to enable persistence in helm prometheus-operator
问题描述
我正在使用prometheus-operator
掌舵图.我希望持久化Prometheus服务器中的数据.但是prometheus
StatefulSet
的打开重启,数据消失了.检查关联的StatefulSet
和Pod
对象的yaml
定义时,没有PersistVolumeClaim
.
I am using the prometheus-operator
helm chart. I want the data in prometheus server to persist. But open restart of the prometheus
StatefulSet
, the data disappears. When inspecting the yaml
definitions of the associated StatefulSet
and Pod
objects, there is no PersistVolumeClaim
.
根据 https中的文档,我尝试了对values.yaml
的以下更改: //github.com/helm/charts/tree/master/stable/prometheus :
I tried the following change to values.yaml
, per the docs in https://github.com/helm/charts/tree/master/stable/prometheus:
prometheus:
server:
persistentVolume:
enabled: true
但这对最终结果没有影响(即使在重新安装图表并重新安装StatefulSet
之后).
but this has no effect on the end result (even after reinstalling the chart and reinstalling the StatefulSet
).
我希望支持Prometheus服务器的StatefulSet
具有持久的卷声明,以便在重新启动后持久保存数据.
I expect the StatefulSet
backing the prometheus server to have persistent volume claims, so that data is persisted upon restart.
推荐答案
通过向values.yaml
添加prometheus.prometheusSpec.storageSpec
,将PersistentVolumeClaim成功附加到Prometheus服务器:
By adding a prometheus.prometheusSpec.storageSpec
to values.yaml
, the PersistentVolumeClaim was successfully attached to the Prometheus server:
prometheus:
server:
persistentVolume:
enabled: true
prometheusSpec:
storageSpec:
volumeClaimTemplate:
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 10Gi
这篇关于如何在Prometheus-operator中启用持久性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!