From c2952284f9e8560f4d99632bed24f434735eccb7 Mon Sep 17 00:00:00 2001 From: Thomas Richter Date: Tue, 3 Feb 2026 22:09:50 +0100 Subject: [PATCH] feat(08-02): deploy Grafana Alloy for log collection - Add helm/alloy Chart.yaml as umbrella chart for grafana/alloy - Configure Alloy River config for Kubernetes pod log discovery - Set up loki.write endpoint to forward logs to Loki - Configure DaemonSet with control-plane tolerations for all 5 nodes Replaces Promtail (EOL March 2026) with Grafana Alloy Co-Authored-By: Claude Opus 4.5 --- helm/alloy/Chart.yaml | 8 +++++++ helm/alloy/values.yaml | 52 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 helm/alloy/Chart.yaml create mode 100644 helm/alloy/values.yaml diff --git a/helm/alloy/Chart.yaml b/helm/alloy/Chart.yaml new file mode 100644 index 0000000..13e213d --- /dev/null +++ b/helm/alloy/Chart.yaml @@ -0,0 +1,8 @@ +apiVersion: v2 +name: alloy +description: Grafana Alloy log collector +version: 0.1.0 +dependencies: + - name: alloy + version: "0.12.*" + repository: https://grafana.github.io/helm-charts diff --git a/helm/alloy/values.yaml b/helm/alloy/values.yaml new file mode 100644 index 0000000..0c5acf9 --- /dev/null +++ b/helm/alloy/values.yaml @@ -0,0 +1,52 @@ +alloy: + alloy: + configMap: + content: | + // Discover pods and collect logs + discovery.kubernetes "pods" { + role = "pod" + } + + // Relabel to extract pod metadata + discovery.relabel "pods" { + targets = discovery.kubernetes.pods.targets + + rule { + source_labels = ["__meta_kubernetes_namespace"] + target_label = "namespace" + } + rule { + source_labels = ["__meta_kubernetes_pod_name"] + target_label = "pod" + } + rule { + source_labels = ["__meta_kubernetes_pod_container_name"] + target_label = "container" + } + } + + // Collect logs from discovered pods + loki.source.kubernetes "pods" { + targets = discovery.relabel.pods.output + forward_to = [loki.write.default.receiver] + } + + // Forward to Loki + loki.write "default" { + endpoint { + url = "http://loki-stack.monitoring.svc.cluster.local:3100/loki/api/v1/push" + } + } + + controller: + type: daemonset + tolerations: + - key: node-role.kubernetes.io/master + operator: Exists + effect: NoSchedule + - key: node-role.kubernetes.io/control-plane + operator: Exists + effect: NoSchedule + + serviceAccount: + create: true