diff --git a/infra/monitoring/kube-prometheus-stack.yaml b/infra/monitoring/kube-prometheus-stack.yaml new file mode 100644 index 0000000..c9f47da --- /dev/null +++ b/infra/monitoring/kube-prometheus-stack.yaml @@ -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 \ No newline at end of file diff --git a/infra/monitoring/kustomization.yaml b/infra/monitoring/kustomization.yaml index 2706f3b..7c6181e 100644 --- a/infra/monitoring/kustomization.yaml +++ b/infra/monitoring/kustomization.yaml @@ -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 - - + - auth \ No newline at end of file diff --git a/infra/monitoring/pv.yaml b/infra/monitoring/pv.yaml new file mode 100644 index 0000000..41e0bd8 --- /dev/null +++ b/infra/monitoring/pv.yaml @@ -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 \ No newline at end of file diff --git a/infra/monitoring/values.yaml b/infra/monitoring/values.yaml new file mode 100644 index 0000000..78cba57 --- /dev/null +++ b/infra/monitoring/values.yaml @@ -0,0 +1,14 @@ +prometheus: + prometheusSpec: + storageSpec: + volumeClaimTemplate: + spec: + storageClassName: prometheus + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi + selector: + matchLabels: + app: prometheus