k8s-1.28.2 部署prometheus

发布于:2025-02-11 ⋅ 阅读:(78) ⋅ 点赞:(0)

一、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: true
    ingressClassName: nginx
    annotations: {}
    labels: {}
    hosts:
      - alertmanager.kyc.com
    paths:
     - /
storage:
     volumeClaimTemplate:
       spec:
         storageClassName: nfs-logs
         accessModes: ["ReadWriteOnce"]
         resources:
           requests:
             storage: 50Gi

# grafana  修改
ingress:
    enabled: true
    ingressClassName: nginx
    annotations: {}
    labels: {}
    hosts:
      - grafana.kyc.com
    path: /


# prometheus: 修改
ingress:
    enabled: true
    ingressClassName: nginx
    annotations: {}
    labels: {}
    hosts:
      - prometheus.kys.com
    paths:
     - /
## 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-logs
          accessModes: ["ReadWriteOnce"]
          resources:
            requests:
              storage: 70Gi

# helm upgrade --install prometheus ./ -f values.yaml  -n prometheus

四、测试

grafana<prom-operator>:

密码:

# kubectl get secret -n prometheus prometheus-grafana -o jsonpath="{.data.admin-password}"|base64 --decode

五、添加数据源

有默认的,不用配置。

六、下载模板

下载模板:Grafana dashboards | Grafana Labs

七、导入dashboard