gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 01:09:39 25 4
gpt4 key购买 nike

我正在尝试使用 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. 部署成功,但存储创建为 emptyDirpod 存储片段
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

关于kubernetes - 即使在指定 VolumeClaimTemplate 之后,kube-prometheus-stack 仍将 EmptyDir 用作存储,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65267112/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com