即使在指定 VolumeClaimTemplate 之后,kube-prometheus-stack 仍将 EmptyDir 用作存储

kube-prometheus-stack is using as EmptyDir as storage even after specifying VolumeClaimTemplate

我正在尝试使用 helm 安装 kube-prometheus-stack 并尝试将持久卷与 hospath 一起使用,即使在指定 VolumeClaimTemplate 之后创建的 emptyDir 也是存储类型。

这些是我遵循的步骤:

  1. 创建了一个 PV
kind: PersistentVolume
metadata:
  name: prometheus-pv
  labels:
    app: prometheus
spec:
  capacity:
    storage: 50Gi
  hostPath:
    path: /data/prometheus/pv4
    type: ''
  accessModes:
    - ReadWriteOnce
  1. 已修改存储部分中的默认值文件:
    resources: {}
    # requests:
    #   memory: 400Mi

    ## Prometheus StorageSpec for persistent data
    ## ref: https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/user-guides/storage.md
    ##
    storageSpec:
    ## Using PersistentVolumeClaim
    ##
    volumeClaimTemplate:
      spec:
        storageClassName: ""
        accessModes: ["ReadWriteOnce"]
        resources:
          requests:
            storage: 50Gi
      selector:
          matchLabels:
            app: prometheus
  1. 使用 helm 安装了 kube-prometheus-stack
helm install  --values Prometheus.yaml promethes  prometheus-community/kube-prometheus-stack --namespace prometheusstack
  1. 部署成功但存储创建为emptyDir pod 存储片段
spec:
  volumes:
    - name: config
      secret:
        secretName: prometheus-promethes-kube-prometheus-prometheus
        defaultMode: 420
    - name: tls-assets
      secret:
        secretName: prometheus-promethes-kube-prometheus-prometheus-tls-assets
        defaultMode: 420
    - name: config-out
      emptyDir: {}
    - name: prometheus-promethes-kube-prometheus-prometheus-rulefiles-0
      configMap:
        name: prometheus-promethes-kube-prometheus-prometheus-rulefiles-0
        defaultMode: 420
    - name: prometheus-promethes-kube-prometheus-prometheus-db
      emptyDir: {}
    - name: promethes-kube-prometheus-prometheus-token-nwwxv
      secret:
        secretName: promethes-kube-prometheus-prometheus-token-nwwxv
        defaultMode: 420

您缺少身份证明。 正确的值应该是:

    storageSpec:
      ## Using PersistentVolumeClaim
      ##
      volumeClaimTemplate:
        spec:
          storageClassName: ""
          accessModes: ["ReadWriteOnce"]
          resources:
            requests:
              storage: 50Gi
        selector:
          matchLabels:
            app: prometheus