# Prepare the node-local directories before the local PersistentVolumes are # made available. The hook is idempotent and runs before every Argo CD sync. apiVersion: batch/v1 kind: Job metadata: name: monitoring-storage-prepare namespace: prometheus annotations: argocd.argoproj.io/hook: PreSync argocd.argoproj.io/hook-delete-policy: BeforeHookCreation,HookSucceeded argocd.argoproj.io/sync-wave: "-2" spec: backoffLimit: 3 template: spec: restartPolicy: OnFailure nodeSelector: homelab.hexor.cy/pool: core homelab.hexor.cy/exposure: external kubernetes.io/hostname: music containers: - name: prepare image: docker.io/busybox:1.37.0 command: - sh - -ec - | mkdir -p /storage/prometheus /storage/alertmanager /storage/loki chown 1000:2000 /storage/prometheus /storage/alertmanager chown 10001:10001 /storage/loki chmod 0770 /storage/prometheus /storage/alertmanager /storage/loki securityContext: runAsNonRoot: false runAsUser: 0 allowPrivilegeEscalation: false seccompProfile: type: RuntimeDefault volumeMounts: - name: storage mountPath: /storage volumes: - name: storage hostPath: path: /data/k8s/monitoring type: DirectoryOrCreate --- apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: monitoring-local annotations: argocd.argoproj.io/sync-wave: "-1" argocd.argoproj.io/sync-options: Prune=false provisioner: kubernetes.io/no-provisioner volumeBindingMode: WaitForFirstConsumer reclaimPolicy: Retain --- apiVersion: v1 kind: PersistentVolume metadata: name: monitoring-prometheus-music labels: monitoring.hexor.cy/volume: prometheus annotations: argocd.argoproj.io/sync-wave: "-1" argocd.argoproj.io/sync-options: Prune=false spec: capacity: storage: 500Gi volumeMode: Filesystem accessModes: [ReadWriteOnce] persistentVolumeReclaimPolicy: Retain storageClassName: monitoring-local local: path: /data/k8s/monitoring/prometheus nodeAffinity: required: nodeSelectorTerms: - matchExpressions: - key: kubernetes.io/hostname operator: In values: [music] --- apiVersion: v1 kind: PersistentVolume metadata: name: monitoring-alertmanager-music labels: monitoring.hexor.cy/volume: alertmanager annotations: argocd.argoproj.io/sync-wave: "-1" argocd.argoproj.io/sync-options: Prune=false spec: capacity: storage: 5Gi volumeMode: Filesystem accessModes: [ReadWriteOnce] persistentVolumeReclaimPolicy: Retain storageClassName: monitoring-local local: path: /data/k8s/monitoring/alertmanager nodeAffinity: required: nodeSelectorTerms: - matchExpressions: - key: kubernetes.io/hostname operator: In values: [music] --- apiVersion: v1 kind: PersistentVolume metadata: name: monitoring-loki-music labels: monitoring.hexor.cy/volume: loki annotations: argocd.argoproj.io/sync-wave: "-1" argocd.argoproj.io/sync-options: Prune=false spec: capacity: storage: 200Gi volumeMode: Filesystem accessModes: [ReadWriteOnce] persistentVolumeReclaimPolicy: Retain storageClassName: monitoring-local local: path: /data/k8s/monitoring/loki nodeAffinity: required: nodeSelectorTerms: - matchExpressions: - key: kubernetes.io/hostname operator: In values: [music] --- # Keep monitoring schedulable under application-node pressure without competing # with Kubernetes' system-cluster-critical classes. apiVersion: scheduling.k8s.io/v1 kind: PriorityClass metadata: name: monitoring-critical annotations: argocd.argoproj.io/sync-wave: "-1" value: 1000000 globalDefault: false description: Monitoring control plane and storage workloads