feat(loki): add single-binary loki and alloy stack
Filesystem storage on local-path-retain, 14d retention. Alloy daemonset ships k8s pod logs to loki-gateway.
This commit is contained in:
1 parent
82949613db
commit
34c33697bb
3 files changed
+154
No files matched your search
Whitespace-only changes.
@@ -0,0 +1,57 @@
|
|||||||
|
# Pinned chart: grafana/alloy 1.12.1 (app v1.19.2).
|
||||||
|
# Install (deferred to deploy task, namespace prometheus):
|
||||||
|
# helm upgrade --install alloy grafana/alloy --version 1.12.1 \
|
||||||
|
# --namespace prometheus --values loki/k8s/alloy-values.yaml --wait
|
||||||
|
# DaemonSet ships k8s pod logs (API-tailed, no hostPath mounts) to Loki.
|
||||||
|
# Scope phase 1: k8s only, compose leftovers out.
|
||||||
|
|
||||||
|
controller:
|
||||||
|
type: daemonset
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: "128Mi"
|
||||||
|
cpu: "50m"
|
||||||
|
limits:
|
||||||
|
memory: "512Mi"
|
||||||
|
cpu: "500m"
|
||||||
|
|
||||||
|
image:
|
||||||
|
tag: "v1.19.2"
|
||||||
|
|
||||||
|
alloy:
|
||||||
|
configMap:
|
||||||
|
create: true
|
||||||
|
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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
loki.source.kubernetes "pods" {
|
||||||
|
targets = discovery.relabel.pods.output
|
||||||
|
forward_to = [loki.write.default.receiver]
|
||||||
|
}
|
||||||
|
|
||||||
|
loki.write "default" {
|
||||||
|
endpoint {
|
||||||
|
url = "http://loki-gateway.prometheus.svc.cluster.local/loki/api/v1/push"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
# Pinned chart: grafana/loki 7.3.0 (app 3.6.12).
|
||||||
|
# Install (deferred to deploy task, namespace prometheus):
|
||||||
|
# helm upgrade --install loki grafana/loki --version 7.3.0 \
|
||||||
|
# --namespace prometheus --values loki/k8s/loki-values.yaml --wait
|
||||||
|
# SingleBinary, filesystem storage on local-path-retain, 14d retention.
|
||||||
|
# No IngressRoute: Loki is cluster-internal, queried via Grafana datasource.
|
||||||
|
|
||||||
|
deploymentMode: SingleBinary
|
||||||
|
|
||||||
|
loki:
|
||||||
|
# Multitenancy off: single-node homelab, gateway + Alloy + Grafana talk to one tenant.
|
||||||
|
auth_enabled: false
|
||||||
|
image:
|
||||||
|
tag: "3.6.12"
|
||||||
|
commonConfig:
|
||||||
|
# Single replica: default RF=3 would require 3 ingesters and fail all writes.
|
||||||
|
replication_factor: 1
|
||||||
|
storage:
|
||||||
|
type: filesystem
|
||||||
|
schemaConfig:
|
||||||
|
configs:
|
||||||
|
- from: "2024-04-01"
|
||||||
|
store: tsdb
|
||||||
|
object_store: filesystem
|
||||||
|
schema: v13
|
||||||
|
index:
|
||||||
|
prefix: index_
|
||||||
|
period: 24h
|
||||||
|
compactor:
|
||||||
|
retention_enabled: true
|
||||||
|
delete_request_store: filesystem
|
||||||
|
limits_config:
|
||||||
|
retention_period: 336h
|
||||||
|
rulerConfig:
|
||||||
|
wal:
|
||||||
|
dir: /var/loki/ruler-wal
|
||||||
|
storage:
|
||||||
|
type: local
|
||||||
|
local:
|
||||||
|
directory: /var/loki/rules
|
||||||
|
|
||||||
|
singleBinary:
|
||||||
|
replicas: 1
|
||||||
|
persistence:
|
||||||
|
enabled: true
|
||||||
|
size: 20Gi
|
||||||
|
storageClass: local-path-retain
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: "512Mi"
|
||||||
|
cpu: "200m"
|
||||||
|
limits:
|
||||||
|
memory: "2Gi"
|
||||||
|
cpu: "1000m"
|
||||||
|
|
||||||
|
# Zeroed: unused in SingleBinary mode (chart validation requires it).
|
||||||
|
write:
|
||||||
|
replicas: 0
|
||||||
|
read:
|
||||||
|
replicas: 0
|
||||||
|
backend:
|
||||||
|
replicas: 0
|
||||||
|
|
||||||
|
gateway:
|
||||||
|
replicas: 1
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
memory: "64Mi"
|
||||||
|
cpu: "50m"
|
||||||
|
limits:
|
||||||
|
memory: "256Mi"
|
||||||
|
cpu: "300m"
|
||||||
|
|
||||||
|
monitoring:
|
||||||
|
serviceMonitor:
|
||||||
|
enabled: true
|
||||||
|
labels:
|
||||||
|
release: prometheus-stack
|
||||||
|
interval: 15s
|
||||||
|
rules:
|
||||||
|
enabled: true
|
||||||
|
namespace: prometheus
|
||||||
|
labels:
|
||||||
|
release: prometheus-stack
|
||||||
|
|
||||||
|
# Disabled: memcached caches don't fit a memory-tight single node.
|
||||||
|
# SingleBinary works without them (slower repeated queries, fine at homelab scale).
|
||||||
|
resultsCache:
|
||||||
|
enabled: false
|
||||||
|
chunksCache:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
# Disabled: synthetic canary traffic + helm test pod, noise on a single node.
|
||||||
|
lokiCanary:
|
||||||
|
enabled: false
|
||||||
|
test:
|
||||||
|
enabled: false
|
||||||
Reference in new issue
Block a user