一、prometheus helm仓库
## 网站地址
# https://artifacthub.io/## prometheus 地址
# https://artifacthub.io/packages/helm/prometheus-community/prometheus
.
# helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
# helm repo update
二、下载及解压
# helm search repo prometheus-community
# helm pull prometheus-community/kube-prometheus-stack
三、修改values.yaml文件
# alertmanager: 修改ingress:enabled: trueingressClassName: nginxannotations: {}labels: {}hosts:- alertmanager.kyc.compaths:- /
storage:volumeClaimTemplate:spec:storageClassName: nfs-logsaccessModes: ["ReadWriteOnce"]resources:requests:storage: 50Gi# grafana 修改
ingress:enabled: trueingressClassName: nginxannotations: {}labels: {}hosts:- grafana.kyc.compath: /# prometheus: 修改
ingress:enabled: trueingressClassName: nginxannotations: {}labels: {}hosts:- prometheus.kys.compaths:- /
## Prometheus StorageSpec for persistent data## ref: https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/user-guides/storage.md##storageSpec:## Using PersistentVolumeClaim##volumeClaimTemplate:spec:storageClassName: nfs-logsaccessModes: ["ReadWriteOnce"]resources:requests:storage: 70Gi
# helm upgrade --install prometheus ./ -f values.yaml -n prometheus
四、测试
grafana:
密码:
# kubectl get secret -n prometheus prometheus-grafana -o jsonpath="{.data.admin-password}"|base64 --decode
五、添加数据源
有默认的,不用配置。
六、下载模板
下载模板:Grafana dashboards | Grafana Labs