使用带有卷的普罗米修斯来存储数据

Using prometheus with volume to store data

我们使用 prometheus-operator 几个月了,效果很好。 现在我们需要添加持久卷来保存 3 个月的数据,我们使用以下内容。

https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack

我添加了以下内容:(我们有 gp2 存储 class)

storageSpec:
  volumeClaimTemplate:
    spec:
      storageClassName: gp2
      accessModes: ["ReadWriteOnce"]
      resources:
        requests:
          storage: 50Gi

https://github.com/prometheus-community/helm-charts/blob/main/charts/kube-prometheus-stack/values.yaml#L1969

我得到错误:

persistentvolumeclaim "prometheus-po-kube-prometheus-stack-prometheus-db-prometheus-po-kube-prometheus-stack-prometheus-0" not found,

除了 values.yaml 我还应该添加一些东西吗?

您缺少组件参考,您必须指定为哪个组件定义存储 - prometheus.prometheusSpec

试试这个:

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

您可以在 values.yaml

中找到更多信息