about summary refs log tree commit diff
diff options
context:
space:
mode:
authormakefunstuff <[email protected]>2024-06-28 18:35:39 +0200
committermakefunstuff <[email protected]>2024-06-28 18:35:39 +0200
commit02703a96ecf343b793b02edbda97a54e186bf5b3 (patch)
tree3aa6962f0fce178235e1e3c226897641c892cb35
parentc6292662cd65ba74a15841c8e698e64bfbcc65cb (diff)
downloadk3s-lab-02703a96ecf343b793b02edbda97a54e186bf5b3.tar.gz
boom
Diffstat (limited to '')
-rw-r--r--cd/monitoring.yaml19
-rwxr-xr-xscripts/add-apps5
-rw-r--r--tools/monitoring/Chart.yaml20
-rw-r--r--tools/monitoring/values.yaml81
4 files changed, 125 insertions, 0 deletions
diff --git a/cd/monitoring.yaml b/cd/monitoring.yaml
new file mode 100644
index 0000000..0ac401c
--- /dev/null
+++ b/cd/monitoring.yaml
@@ -0,0 +1,19 @@
+kapiVersion: argoproj.io/v1alpha1
+kind: Application
+metadata:
+  name: monitoring
+  namespace: argocd
+spec:
+  project: default
+  source:
+    repoURL: 'https://github.com/makefunstuff/k3s-lab'
+    targetRevision: HEAD
+    path: monitoring
+  destination:
+    server: 'https://kubernetes.default.svc'
+    namespace: monitoring
+  syncPolicy:
+    automated:
+      prune: true
+      selfHeal: true
+
diff --git a/scripts/add-apps b/scripts/add-apps
new file mode 100755
index 0000000..daa9ffd
--- /dev/null
+++ b/scripts/add-apps
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+set -e
+
+kubectl apply -f cd/monitoring.yaml
diff --git a/tools/monitoring/Chart.yaml b/tools/monitoring/Chart.yaml
new file mode 100644
index 0000000..fa9f207
--- /dev/null
+++ b/tools/monitoring/Chart.yaml
@@ -0,0 +1,20 @@
+apiVersion: v2
+name: monitoring
+description: A Helm chart for setting up Grafana, Prometheus, Elasticsearch, and OpenTelemetry Collector
+version: 0.1.0
+appVersion: "1.0"
+
+dependencies:
+  - name: grafana
+    version: 11.0.0
+    repository: "https://grafana.github.io/helm-charts"
+  - name: prometheus
+    version: 2.53.0
+    repository: "https://prometheus-community.github.io/helm-charts"
+  - name: elasticsearch
+    version: 8.5.1
+    repository: "https://helm.elastic.co"
+  - name: opentelemetry-collector
+    version: 0.103.0
+    repository: "https://open-telemetry.github.io/opentelemetry-helm-charts"
+
diff --git a/tools/monitoring/values.yaml b/tools/monitoring/values.yaml
new file mode 100644
index 0000000..195209f
--- /dev/null
+++ b/tools/monitoring/values.yaml
@@ -0,0 +1,81 @@
+global:
+  namespace: monitoring
+
+grafana:
+  ingress:
+    enabled: true
+    annotations:
+      traefik.ingress.kubernetes.io/router.entrypoints: websecure
+      traefik.ingress.kubernetes.io/router.tls: "true"
+      traefik.ingress.kubernetes.io/router.tls.certresolver: "default"
+      traefik.ingress.kubernetes.io/redirect-entry-point: https
+    hosts:
+      - grafana.topkek.cloud
+    path: /
+    tls:
+      - hosts:
+          - grafana.topkek.cloud
+        secretName: grafana-tls
+
+  datasources:
+    datasources.yaml:
+      apiVersion: 1
+      datasources:
+        - name: Prometheus
+          type: prometheus
+          access: proxy
+          url: http://prometheus-server.monitoring.svc.cluster.local
+          isDefault: true
+        - name: Elasticsearch
+          type: elasticsearch
+          access: proxy
+          url: http://elasticsearch-master.monitoring.svc.cluster.local:9200
+          jsonData:
+            esVersion: 7
+            timeField: "@timestamp"
+
+prometheus:
+  alertmanager:
+    enabled: true
+  pushgateway:
+    enabled: true
+  server:
+    enabled: true
+
+elasticsearch:
+  volumeClaimTemplate:
+    accessModes: [ "ReadWriteOnce" ]
+    resources:
+      requests:
+        storage: 30Gi
+
+opentelemetry-collector:
+  config:
+    receivers:
+      otlp:
+        protocols:
+          grpc:
+          http:
+    processors:
+      batch:
+    exporters:
+      prometheusremotewrite:
+        endpoint: "http://prometheus-server.monitoring.svc.cluster.local/api/v1/write"
+      logging:
+        loglevel: debug
+      elasticsearch:
+        endpoints: ["http://elasticsearch-master.monitoring.svc.cluster.local:9200"]
+        index: "otel-logs-%{+yyyy.MM.dd}"
+    service:
+      pipelines:
+        metrics:
+          receivers: [otlp]
+          processors: [batch]
+          exporters: [prometheusremotewrite]
+        logs:
+          receivers: [otlp]
+          processors: [batch]
+          exporters: [logging, elasticsearch]
+  otelcol:
+    enabled: true
+