From 9f48b84947f0984b959c95f27c3b17f1d9dcb520 Mon Sep 17 00:00:00 2001 From: TapTap Date: Tue, 20 Oct 2026 15:53:22 +0200 Subject: [PATCH] add monitoring --- monitoring/apply.sh | 1 + monitoring/kustomization.yaml | 17 ++++++++++ monitoring/namespace.yaml | 4 +++ monitoring/storage.yaml | 21 ++++++++++++ monitoring/values.yaml | 61 +++++++++++++++++++++++++++++++++++ 5 files changed, 104 insertions(+) create mode 100755 monitoring/apply.sh create mode 100644 monitoring/kustomization.yaml create mode 100644 monitoring/namespace.yaml create mode 100644 monitoring/storage.yaml create mode 100644 monitoring/values.yaml diff --git a/monitoring/apply.sh b/monitoring/apply.sh new file mode 100755 index 0000000..36f4420 --- /dev/null +++ b/monitoring/apply.sh @@ -0,0 +1 @@ +kustomize build . --enable-helm | kubectl apply --server-side --force-conflicts -f - &> log.txt diff --git a/monitoring/kustomization.yaml b/monitoring/kustomization.yaml new file mode 100644 index 0000000..64bb5fb --- /dev/null +++ b/monitoring/kustomization.yaml @@ -0,0 +1,17 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +namespace: monitoring + +resources: + - namespace.yaml + - storage.yaml + +helmCharts: + - name: kube-prometheus-stack + repo: https://prometheus-community.github.io/helm-charts + version: 88.2.0 + releaseName: prometheus + namespace: monitoring + valuesFile: values.yaml + includeCRDs: true diff --git a/monitoring/namespace.yaml b/monitoring/namespace.yaml new file mode 100644 index 0000000..d325236 --- /dev/null +++ b/monitoring/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: monitoring diff --git a/monitoring/storage.yaml b/monitoring/storage.yaml new file mode 100644 index 0000000..5fcd362 --- /dev/null +++ b/monitoring/storage.yaml @@ -0,0 +1,21 @@ +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: prometheus-manual +provisioner: kubernetes.io/no-provisioner +volumeBindingMode: WaitForFirstConsumer +--- +apiVersion: v1 +kind: PersistentVolume +metadata: + name: prometheus-hostpath-pv +spec: + capacity: + storage: 10Gi + accessModes: + - ReadWriteOnce + persistentVolumeReclaimPolicy: Retain + storageClassName: prometheus-manual + hostPath: + path: /root/kubernetes/monitoring/data/prometheus + type: DirectoryOrCreate diff --git a/monitoring/values.yaml b/monitoring/values.yaml new file mode 100644 index 0000000..55ac6c2 --- /dev/null +++ b/monitoring/values.yaml @@ -0,0 +1,61 @@ +# Disable components K3s packs internally or embeds into the single binary +kubeControllerManager: + enabled: false + +kubeScheduler: + enabled: false + +kubeEtcd: + enabled: false + +kubeProxy: + enabled: false + +# Enable CoreDNS and Kubelet metrics (K3s standard) +coreDns: + enabled: true + +kubelet: + enabled: true + +# Node Exporter (Gathers host CPU, Memory, Disk, and Network stats) +nodeExporter: + enabled: true + +# Grafana Web Dashboard Configuration +grafana: + enabled: true + adminPassword: TODO + persistence: + enabled: false + # extraVolumeMounts: # TODO: enable again but another monuntPath (subpaths probably necessary because this one is already used) + # - name: storage + # mountPath: /var/lib/grafana + # extraVolumes: + # - name: storage + # hostPath: + # path: /root/kubernetes/monitoring/data/grafana + # type: DirectoryOrCreate + ingress: + enabled: true + annotations: + cert-manager.io/cluster-issuer: "letsencrypt-issuer" + hosts: + - grafana.tap-tap.win + tls: + - hosts: + - grafana.tap-tap.win + secretName: grafana-tls-secret + +# Prometheus Time-Series Database Configuration +prometheus: + prometheusSpec: + retention: 7d + storageSpec: + volumeClaimTemplate: + spec: + storageClassName: prometheus-manual + accessModes: ["ReadWriteOnce"] + resources: + requests: + storage: 10Gi