简体   繁体   English

使用带volume的prometheus存储数据

[英]Using prometheus with volume to store data

We are using prometheus-operator with the for several month which working great.我们正在使用 prometheus-operator 几个月,效果很好。 Now we need to add persistent volume to save the data for 3 month and we use the following.现在我们需要添加持久卷以将数据保存 3 个月,我们使用以下内容。

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

I've added the following: (we have gp2 storage class)我添加了以下内容:(我们有 gp2 存储类)

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 https://github.com/prometheus-community/helm-charts/blob/main/charts/kube-prometheus-stack/values.yaml#L1969

And I got error:我得到了错误:

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

should I add something in addition to the values.yaml?除了 values.yaml 之外,我还应该添加一些东西吗?

You are missing components reference, you have to specify for which component you define storage - prometheus.prometheusSpec您缺少组件参考,您必须指定为哪个组件定义存储 - prometheus.prometheusSpec

Try this:尝试这个:

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

You can find more in values.yaml您可以在values.yaml中找到更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM