Alloy
Grafana Alloy ist ein OpenTelemetry-kompatibler Collector und Nachfolger des Grafana Agents. Er sammelt Logs, Metriken und Traces und leitet sie an Grafana Cloud oder lokale Backends weiter.
config.alloy
// Logs von allen Kubernetes-Pods sammeln
loki.source.kubernetes "pods" {
targets = discovery.kubernetes.pods.targets
forward_to = [loki.write.grafana_cloud.receiver]
}
discovery.kubernetes "pods" {
role = "pod"
}
// Logs an Grafana Cloud Loki senden
loki.write "grafana_cloud" {
endpoint {
url = env("LOKI_URL")
basic_auth {
username = env("LOKI_USERNAME")
password = env("LOKI_PASSWORD")
}
}
}
Als DaemonSet in Kubernetes deployen
# Alloy Helm Repo
helm repo add grafana https://grafana.github.io/helm-charts
helm repo update
helm install alloy grafana/alloy \
-n monitoring --create-namespace \
-f alloy-values.yaml
kubectl get daemonset -n monitoring
kubectl get pods -n monitoring -o wide # ein Pod pro Node
Alloy UI
kubectl port-forward svc/alloy 12345:12345 -n monitoring --address=0.0.0.0
# http://[ip]:12345
Die Alloy UI zeigt den konfigurierten Datenfluss (Pipeline) als Graph an und ermöglicht das Debuggen einzelner Komponenten.
Weitere Informationen
- https://grafana.com/docs/alloy/
- https://grafana.com/docs/alloy/latest/reference/components/