Skip to content

kube-prometheus-stack

Namespace - monitoring

Prometheus | Grafana | AlertManager

ArtfactHUB

Charts

https://github.com/prometheus-community/helm-charts

kube-prometheus-stack

Install

Bash
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
Bash
kubectl create namespace monitoring

Create kube-prometheus-stack-pv.yaml:

YAML
apiVersion: v1
kind: PersistentVolume
metadata:
  name: kube-prometheus-stack-pv
spec:
  storageClassName: kube-prometheus-stack
  capacity:
    storage: 100Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/monitoring/kube-stack"

Create kube-prometheus-stack-pvc.yaml:

YAML
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: prometheus-kube-prometheus-stack-prometheus-db-prometheus-kube-prometheus-stack-prometheus-0  # Must have this name if you don't wanna change default pvc name
  namespace: monitoring
spec:
  storageClassName: kube-prometheus-stack
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 100Gi
  volumeName: kube-prometheus-stack-pv

Apply volumes.

Custom Values

  • custom-values.yaml
YAML
prometheus:
  enabled: true

  prometheusSpec:
    ## If true, pass --storage.tsdb.max-block-duration=2h to prometheus. This is already done if using Thanos
    ##
    disableCompaction: false

    retention: 10d

    ## Maximum size of metrics
    ##
    retentionSize: ""

    storageSpec:
    ## Using PersistentVolumeClaim
    ##
      volumeClaimTemplate:
        spec:
          storageClassName: kube-prometheus-stack
          accessModes: ["ReadWriteOnce"]
          resources:
            requests:
              storage: 100Gi

grafana:
  enabled: true

  adminPassword: Password
  • Install manually
Bash
helm install -f custom-volumes.yaml kube-prometheus-stack prometheus-community/kube-prometheus-stack -n monitoring

Alerts | Prometheus rules

Awesome link