summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-01-07 23:13:29 +0200
committerPaul Buetow <paul@buetow.org>2026-01-07 23:13:29 +0200
commitc508f37fb97c1881c0452daa242dc1ae9db12d1a (patch)
treebf54a31f85ced643f078a1763e53fe3e0a88a529
parent19a8b3cb725554141e8d5c166060e44079f19735 (diff)
Migrate Loki and Alloy to ArgoCD GitOps
- Created two ArgoCD Application manifests (loki and alloy) - Updated Justfile with ArgoCD commands for both apps - Loki: log aggregation (SingleBinary mode, 10Gi storage) - Alloy: log collection DaemonSet + OTLP receiver for traces - Both apps are Synced and Healthy - Alloy forwards logs to Loki and traces to Tempo 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
-rw-r--r--f3s/argocd-apps/alloy.yaml130
-rw-r--r--f3s/argocd-apps/loki.yaml86
-rw-r--r--f3s/loki/Justfile69
3 files changed, 270 insertions, 15 deletions
diff --git a/f3s/argocd-apps/alloy.yaml b/f3s/argocd-apps/alloy.yaml
new file mode 100644
index 0000000..c5574b1
--- /dev/null
+++ b/f3s/argocd-apps/alloy.yaml
@@ -0,0 +1,130 @@
+apiVersion: argoproj.io/v1alpha1
+kind: Application
+metadata:
+ name: alloy
+ namespace: cicd
+ finalizers:
+ - resources-finalizer.argocd.argoproj.io
+spec:
+ project: default
+ source:
+ repoURL: https://grafana.github.io/helm-charts
+ chart: alloy
+ targetRevision: 0.3.2
+ helm:
+ releaseName: alloy
+ valuesObject:
+ alloy:
+ service:
+ ports:
+ otlp-grpc:
+ enabled: true
+ port: 4317
+ targetPort: 4317
+ protocol: TCP
+ otlp-http:
+ enabled: true
+ port: 4318
+ targetPort: 4318
+ protocol: TCP
+
+ configMap:
+ content: |
+ discovery.kubernetes "pods" {
+ role = "pod"
+ }
+
+ 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"
+ }
+
+ rule {
+ source_labels = ["__meta_kubernetes_pod_label_app"]
+ target_label = "app"
+ }
+ }
+
+ loki.source.kubernetes "pods" {
+ targets = discovery.relabel.pods.output
+ forward_to = [loki.write.default.receiver]
+ }
+
+ loki.write "default" {
+ endpoint {
+ url = "http://loki.monitoring.svc.cluster.local:3100/loki/api/v1/push"
+ }
+ }
+
+ // ========================================
+ // TRACES COLLECTION
+ // ========================================
+
+ // OTLP receiver for traces via gRPC and HTTP
+ otelcol.receiver.otlp "default" {
+ grpc {
+ endpoint = "0.0.0.0:4317"
+ }
+
+ http {
+ endpoint = "0.0.0.0:4318"
+ }
+
+ output {
+ traces = [otelcol.processor.batch.default.input]
+ }
+ }
+
+ // Batch processor for efficient trace forwarding
+ otelcol.processor.batch "default" {
+ timeout = "5s"
+ send_batch_size = 100
+ send_batch_max_size = 200
+
+ output {
+ traces = [otelcol.exporter.otlp.tempo.input]
+ }
+ }
+
+ // OTLP exporter to send traces to Tempo
+ otelcol.exporter.otlp "tempo" {
+ client {
+ endpoint = "tempo.monitoring.svc.cluster.local:4317"
+
+ tls {
+ insecure = true
+ }
+
+ compression = "gzip"
+ }
+ }
+
+ destination:
+ server: https://kubernetes.default.svc
+ namespace: monitoring
+
+ syncPolicy:
+ automated:
+ prune: true
+ selfHeal: true
+ syncOptions:
+ - CreateNamespace=false
+ retry:
+ limit: 3
+ backoff:
+ duration: 5s
+ factor: 2
+ maxDuration: 1m
diff --git a/f3s/argocd-apps/loki.yaml b/f3s/argocd-apps/loki.yaml
new file mode 100644
index 0000000..c7985c2
--- /dev/null
+++ b/f3s/argocd-apps/loki.yaml
@@ -0,0 +1,86 @@
+apiVersion: argoproj.io/v1alpha1
+kind: Application
+metadata:
+ name: loki
+ namespace: cicd
+ finalizers:
+ - resources-finalizer.argocd.argoproj.io
+spec:
+ project: default
+ source:
+ repoURL: https://grafana.github.io/helm-charts
+ chart: loki
+ targetRevision: 6.6.3
+ helm:
+ releaseName: loki
+ valuesObject:
+ deploymentMode: SingleBinary
+
+ loki:
+ auth_enabled: false
+ commonConfig:
+ replication_factor: 1
+ storage:
+ type: filesystem
+ schemaConfig:
+ configs:
+ - from: "2024-01-01"
+ store: tsdb
+ object_store: filesystem
+ schema: v13
+ index:
+ prefix: index_
+ period: 24h
+
+ singleBinary:
+ replicas: 1
+ extraVolumes:
+ - name: loki-data
+ persistentVolumeClaim:
+ claimName: loki-data-pvc
+ extraVolumeMounts:
+ - name: loki-data
+ mountPath: /var/loki
+ persistence:
+ enabled: false
+
+ read:
+ replicas: 0
+
+ write:
+ replicas: 0
+
+ backend:
+ replicas: 0
+
+ gateway:
+ enabled: false
+
+ chunksCache:
+ enabled: false
+
+ resultsCache:
+ enabled: false
+
+ lokiCanary:
+ enabled: false
+
+ test:
+ enabled: false
+
+ destination:
+ server: https://kubernetes.default.svc
+ namespace: monitoring
+
+ syncPolicy:
+ automated:
+ prune: true
+ selfHeal: true
+ syncOptions:
+ - CreateNamespace=false
+ retry:
+ limit: 3
+ backoff:
+ duration: 5s
+ factor: 2
+ maxDuration: 1m
diff --git a/f3s/loki/Justfile b/f3s/loki/Justfile
index 395d5d6..10cc6b9 100644
--- a/f3s/loki/Justfile
+++ b/f3s/loki/Justfile
@@ -1,15 +1,54 @@
-install:
- helm repo add grafana https://grafana.github.io/helm-charts || true
- helm repo update
- kubectl apply -f persistent-volumes.yaml
- helm install loki grafana/loki --namespace monitoring -f values.yaml
- helm install alloy grafana/alloy --namespace monitoring -f alloy-values.yaml
-
-uninstall:
- helm uninstall alloy --namespace monitoring
- helm uninstall loki --namespace monitoring
- kubectl delete -f persistent-volumes.yaml
-
-upgrade:
- helm upgrade loki grafana/loki --namespace monitoring -f values.yaml
- helm upgrade alloy grafana/alloy --namespace monitoring -f alloy-values.yaml
+NAMESPACE := "monitoring"
+
+status:
+ @echo "=== Loki Pods ==="
+ @kubectl get pods -n {{NAMESPACE}} -l app.kubernetes.io/name=loki
+ @echo ""
+ @echo "=== Alloy Pods ==="
+ @kubectl get pods -n {{NAMESPACE}} -l app.kubernetes.io/name=alloy
+ @echo ""
+ @echo "=== Services ==="
+ @kubectl get svc -n {{NAMESPACE}} | grep -E '(loki|alloy)'
+ @echo ""
+ @echo "=== PVC ==="
+ @kubectl get pvc -n {{NAMESPACE}} loki-data-pvc
+ @echo ""
+ @echo "=== ArgoCD Status ==="
+ @kubectl get application loki -n cicd -o jsonpath='Loki - Sync: {.status.sync.status}, Health: {.status.health.status}' 2>/dev/null && echo ""
+ @kubectl get application alloy -n cicd -o jsonpath='Alloy - Sync: {.status.sync.status}, Health: {.status.health.status}' 2>/dev/null && echo ""
+
+logs-loki lines="100":
+ kubectl logs -n {{NAMESPACE}} -l app.kubernetes.io/name=loki --tail={{lines}} -f
+
+logs-alloy lines="100":
+ kubectl logs -n {{NAMESPACE}} -l app.kubernetes.io/name=alloy --tail={{lines}} -f
+
+port-forward-loki port="3100":
+ @echo "Forwarding Loki to localhost:{{port}}"
+ kubectl port-forward -n {{NAMESPACE}} svc/loki {{port}}:3100
+
+sync:
+ @echo "Triggering ArgoCD sync for Loki..."
+ @kubectl annotate application loki -n cicd argocd.argoproj.io/refresh=normal --overwrite
+ @echo "Triggering ArgoCD sync for Alloy..."
+ @kubectl annotate application alloy -n cicd argocd.argoproj.io/refresh=normal --overwrite
+ @sleep 2
+ @kubectl get application loki -n cicd -o jsonpath='Loki - Sync: {.status.sync.status}, Health: {.status.health.status}' && echo ""
+ @kubectl get application alloy -n cicd -o jsonpath='Alloy - Sync: {.status.sync.status}, Health: {.status.health.status}' && echo ""
+
+argocd-status:
+ @echo "=== Loki ==="
+ @argocd app get loki --core
+ @echo ""
+ @echo "=== Alloy ==="
+ @argocd app get alloy --core
+
+restart-loki:
+ @echo "Restarting Loki..."
+ kubectl rollout restart -n {{NAMESPACE}} statefulset/loki
+
+restart-alloy:
+ @echo "Restarting Alloy..."
+ kubectl rollout restart -n {{NAMESPACE}} daemonset/alloy
+
+restart: restart-loki restart-alloy