Files
home-network-k3s-impl/platform/monitoring/loki.yaml
T
jakman85andClaude Opus 4.8 d9a80e5350 phase2-prep: per-component no-secret rollout + component hardening (author-first)
Prep only — nothing deployed; running cluster untouched.

Reconciliation graph (operator-approved Option A): author clusters/dev/rollout/
= 4 per-component Flux Kustomizations (kyverno->cilium->longhorn->monitoring,
monitoring dependsOn longhorn). Dev overlay $patch:delete's the monolithic base
platform/apps and adds ./rollout, so only the no-secret tier reconciles; the
secret-blocked components are simply not created until hand-offs arrive. The
no-secret tier carries no SOPS content, so it needs no sops-age key. prod is
untouched (still builds the monolith). Convergence path coded in (delete rollout/
+ the two deletes) — R-ENV-02 divergence flagged for architect review.

Component hardening via cluster-vars (prod keeps strict posture):
- KYVERNO_VALIDATION_ACTION Enforce->Audit(dev), _WEBHOOK_FAILURE_POLICY
  Fail->Ignore(dev), _ADMISSION_REPLICAS 3->1(dev); webhook namespaceSelector
  excludes system+platform namespaces.
- MONITORING_STORAGE_CLASS var; GRAFANA_ADMIN_SECRET var (dev ''=chart default);
  Alertmanager SMTP/secret deferred to Phase-4 with verbatim re-enable markers.

Cilium parity verified against the live CNI (no-op adopt). Validated:
kubectl kustomize dev/prod/all-components, envsubst->YAML parse, make -C ci gate PASS.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-08-16 21:34:57 -05:00

93 lines
3.1 KiB
YAML

---
# Loki — log aggregation (docs/10). Serves R-OBS-01. PVC size is an overlay knob (R-ENV-02).
#
# DEV-SCOPED for the ~22 GiB ceiling. Deployment mode is SingleBinary (one pod, filesystem
# storage) — the scalable read/write/backend split is prod-only. CRITICAL RAM TRIM: the grafana
# loki chart's default memcached caches (chunksCache/resultsCache) request ~8-9 GiB EACH; both are
# disabled here. The nginx `gateway`, self-monitoring, and the canary/test hooks are disabled too.
#
# Retention is enforced by the COMPACTOR (retention_enabled: true) — a retention_period alone does
# nothing (docs/10, and a known-gotcha carried from the legacy stack).
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: loki
namespace: monitoring
spec:
interval: 30m
chart:
spec:
chart: loki
version: ">=6.0.0 <7.0.0" # TODO(WS-OBS): pin at bring-up; Renovate maintains
sourceRef:
kind: HelmRepository
name: grafana
namespace: monitoring
install:
remediation:
retries: 3
upgrade:
remediation:
retries: 3
values:
deploymentMode: SingleBinary
loki:
auth_enabled: false
commonConfig:
replication_factor: 1 # single binary — no ring replication
storage:
type: filesystem
schemaConfig:
configs:
- from: "2024-04-01"
store: tsdb
object_store: filesystem
schema: v13
index:
prefix: loki_index_
period: 24h
limits_config:
# NOTE: Loki's LOG retention has no dedicated cluster-vars knob (only the 3 monitoring vars
# exist). Held to a dev-friendly 72h to mirror the dev metrics retention; promote to an
# overlay knob if per-env log retention is ever needed. See README / report.
retention_period: 72h
compactor:
retention_enabled: true # REQUIRED — a period alone does not delete (docs/10)
delete_request_store: filesystem
singleBinary:
replicas: 1
persistence:
enabled: true
storageClass: ${MONITORING_STORAGE_CLASS} # replicated tier (ADR-0003); cluster-vars knob
size: ${MONITORING_LOKI_PVC_SIZE} # overlay knob (dev 5Gi / prod large)
resources:
requests:
cpu: 100m
memory: 192Mi
limits:
memory: 512Mi
# Not used in SingleBinary mode — pinned to 0 so a chart default can't spin up extra pods.
backend:
replicas: 0
read:
replicas: 0
write:
replicas: 0
# --- RAM trims: kill the memory-hungry / non-essential-for-dev pieces ---
chunksCache:
enabled: false # default memcached requests ~8-9Gi — must stay off in dev
resultsCache:
enabled: false
gateway:
enabled: false # no nginx front door needed for a single binary in-cluster
lokiCanary:
enabled: false
test:
enabled: false
# Alloy ships logs here (in-cluster service DNS, no gateway):
# http://loki.monitoring.svc.cluster.local:3100/loki/api/v1/push