我使用kops在 AWS 上运行了一个 kubernetes 集群。我还使用kube-prometheus设置了 prometheus 和 grafana 。
我想要做的是将普罗米修斯收集的指标存储在 EBS 上。我的持久卷声明 yaml 是:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: prometheus-data
namespace: monitoring
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
prometheus.yaml 是:
apiVersion: monitoring.coreos.com/v1
kind: Prometheus
metadata:
labels:
prometheus: k8s
name: k8s
namespace: monitoring
spec:
alerting:
alertmanagers:
- name: alertmanager-main
namespace: monitoring
port: web
baseImage: quay.io/prometheus/prometheus
nodeSelector:
beta.kubernetes.io/os: linux
replicas: 2
resources:
requests:
memory: 400Mi
volumeMounts:
- name: prometheus-data
mountPath: "/data"
ruleSelector:
matchLabels:
prometheus: k8s
role: alert-rules
volumes:
- name: prometheus-data
persistentVolumeClaim:
claimName: prometheus-data
serviceAccountName: prometheus-k8s
serviceMonitorNamespaceSelector: {}
serviceMonitorSelector: {}
version: v2.4.3
正在创建 10Gi EBS 卷,但它的状态仍然可用。我还尝试删除 prometheus pod,希望能保留数据。不幸的是,情况并非如此。