How to enable persistence in helm prometheus-operator

筅森魡賤 提交于 2021-01-27 05:36:07

问题


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.

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

but this has no effect on the end result (even after reinstalling the chart and reinstalling the StatefulSet).

I expect the StatefulSet backing the prometheus server to have persistent volume claims, so that data is persisted upon restart.


回答1:


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



回答2:


With latest Helm Chart this worked for me: (I'm using AWS)

prometheus:
  prometheusSpec:
    storageSpec:
      volumeClaimTemplate:
        spec:
          storageClassName: gp2
          accessModes: ["ReadWriteOnce"]
          resources:
            requests:
              storage: 10Gi


来源:https://stackoverflow.com/questions/56391693/how-to-enable-persistence-in-helm-prometheus-operator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!