feat(monitoring): Configure kube-prometheus-stack

Use Argo CD Application again.
Provision storage.
This commit is contained in:
Vegard Hagen
2024-04-07 12:08:33 +02:00
parent 4efe769396
commit 91998ecc2a
4 changed files with 72 additions and 17 deletions

View File

@@ -0,0 +1,31 @@
# Need an extra Argo CD Application here to do server side apply
# https://github.com/prometheus-community/helm-charts/issues/3345
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: kube-prometheus-stack
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: infrastructure
sources:
- repoURL: https://prometheus-community.github.io/helm-charts
chart: kube-prometheus-stack
targetRevision: 57.2.1
helm:
valueFiles:
- $values/infra/monitoring/values.yaml
- repoURL: https://github.com/vehagn/homelab
targetRevision: HEAD
ref: values
destination:
name: in-cluster
namespace: monitoring
syncPolicy:
automated:
selfHeal: true
prune: true
syncOptions:
- ApplyOutOfSyncOnly=true
- ServerSideApply=true

View File

@@ -3,21 +3,7 @@ kind: Kustomization
resources:
- ns.yaml
- pv.yaml
- kube-prometheus-stack.yaml
- ingress-route.yaml
- auth
helmCharts:
- name: kube-prometheus-stack
repo: https://prometheus-community.github.io/helm-charts
version: 57.2.1
releaseName: kube-prometheus-stack
namespace: monitoring
valuesInline:
prometheus-node-exporter:
hostRootFsMount:
enabled: false
prometheusOperator:
admissionWebhooks:
failurePolicy: Ignore

24
infra/monitoring/pv.yaml Normal file
View File

@@ -0,0 +1,24 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: prometheus
labels:
app: prometheus
spec:
capacity:
storage: 10Gi
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
storageClassName: prometheus
local:
path: /disk/etc/prometheus
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- gauss

View File

@@ -0,0 +1,14 @@
prometheus:
prometheusSpec:
storageSpec:
volumeClaimTemplate:
spec:
storageClassName: prometheus
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
selector:
matchLabels:
app: prometheus