创建页面,内容为“=kube-prometheus-stack = To monitor your Kubernetes cluster (including Knative functions and OpenEBS storage), here's a lightweight yet comprehensive setup using Prometheus, Grafana, and Alertmanager via the kube-prometheus-stack. This stack is optimized for single-node clusters and includes preconfigured dashboards/alerts. <syntaxhighlight lang="python"> helm repo add prometheus-community https://prometheus-community.github.io/helm-charts helm re…” |
|||
第54行: | 第54行: | ||
-n monitoring --create-namespace \ | -n monitoring --create-namespace \ | ||
-f monitoring-values.yaml | -f monitoring-values.yaml | ||
</syntaxhighlight> | |||
<syntaxhighlight lang="bash"> | |||
$ kubectl get pods -n monitoring | |||
NAME READY STATUS RESTARTS AGE | |||
alertmanager-monitoring-kube-prometheus-alertmanager-0 0/2 PodInitializing 0 21s | |||
monitoring-grafana-7cfd668f87-mkgxj 0/3 PodInitializing 0 35s | |||
monitoring-kube-prometheus-operator-858d674878-pb5jh 1/1 Running 0 35s | |||
monitoring-kube-state-metrics-6568c5bc45-jdz98 1/1 Running 0 35s | |||
monitoring-prometheus-node-exporter-zp9zb 1/1 Running 0 35s | |||
prometheus-monitoring-kube-prometheus-prometheus-0 0/2 PodInitializing 0 21s | |||
</syntaxhighlight> | </syntaxhighlight> |
2025年4月18日 (五) 15:21的最新版本
kube-prometheus-stack
To monitor your Kubernetes cluster (including Knative functions and OpenEBS storage), here's a lightweight yet comprehensive setup using Prometheus, Grafana, and Alertmanager via the kube-prometheus-stack. This stack is optimized for single-node clusters and includes preconfigured dashboards/alerts.
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
config:
# monitoring-values.yaml
prometheus:
prometheusSpec:
storageSpec:
volumeClaimTemplate:
spec:
storageClassName: openebs-hostpath
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 5Gi
resources:
requests:
memory: 512Mi
cpu: 200m
grafana:
adminPassword: "admin"
persistence:
enabled: true
storageClassName: openebs-hostpath
size: 5Gi
alertmanager:
alertmanagerSpec:
resources:
requests:
memory: 256Mi
cpu: 100m
# Disable components not needed for a single-node cluster
kubeEtcd:
enabled: false
kubeControllerManager:
enabled: false
kubeScheduler:
enabled: false
helm install monitoring prometheus-community/kube-prometheus-stack \
-n monitoring --create-namespace \
-f monitoring-values.yaml
$ kubectl get pods -n monitoring
NAME READY STATUS RESTARTS AGE
alertmanager-monitoring-kube-prometheus-alertmanager-0 0/2 PodInitializing 0 21s
monitoring-grafana-7cfd668f87-mkgxj 0/3 PodInitializing 0 35s
monitoring-kube-prometheus-operator-858d674878-pb5jh 1/1 Running 0 35s
monitoring-kube-state-metrics-6568c5bc45-jdz98 1/1 Running 0 35s
monitoring-prometheus-node-exporter-zp9zb 1/1 Running 0 35s
prometheus-monitoring-kube-prometheus-prometheus-0 0/2 PodInitializing 0 21s