Skip to content

Log shipping on the lab: Grafana Alloy → Loki on the phone - #145

Merged
MIERAI merged 2 commits into
mainfrom
log-shipping-lab
Nov 23, 2026
Merged

MIERAI merged 2 commits into
mainfrom
log-shipping-lab

Conversation

@MIERAI

@MIERAI MIERAI commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

Every pod's logs go from the lab to Grafana Loki 3.7.10 on the phone. The phone is the independent third party: it observes the clusters but is not in their request path. This is the lab first; the laptop follows after a soak of at least 1h, as a separate PR.

  • platform/log-shipping (base + lab / laptop overlays; only lab is used here). It runs Grafana Alloy mirror.gcr.io/grafana/alloy:v1.22.0, a 1-replica Deployment (both clusters are single-node), with Recreate rollouts so the same lines are never shipped twice.
    • It reads logs through the API server with loki.source.kubernetes, so it needs no hostPath and doesn't run as root (uid 473). The filesystem is read-only, it is restricted to pods/log, pods and namespaces, and it drops all capabilities.
    • Labels: namespace, pod, container, app, plus the external label cluster=lab. Pods that are not Running are skipped.
    • If the phone is unreachable, loki.write retries a batch 6 times with backoff (at most 30 s apart), then drops it. Meanwhile the source waits and keeps its position, so memory stays bounded (GOMEMLIMIT 160MiB, limit 192Mi, request 20m/96Mi) and the workloads are not affected.
    • A PodMonitor puts Alloy's loki_write_* sent/dropped counters into the cluster's Prometheus.
    • I validated the config with alloy validate --stability.level=generally-available using the pinned image.
  • clusters/lab/extras: new Application platform-log-shipping, namespace log-shipping (CreateNamespace). It isn't covered by the lab sync window.
  • Phone side (not in git): Loki listens on :3100 (push, query and /metrics). It keeps 30 days (compactor), has an emergency 40 GB disk brake, accepts at most 2 MB/s, is managed by ~/services.sh and the watchdog, and the phone's Prometheus scrapes it with an alert rule PhoneLokiDown.

Render evidence (product render.py v0.1.4, main → this branch):

  • laptop: the 28 Applications and the root are byte-identical.
  • lab: the 12 Applications and the root are byte-identical, except extras-lab, which gains one Application platform-log-shipping.
  • New app (kubectl kustomize platform/log-shipping-lab): ServiceAccount, ClusterRole, ClusterRoleBinding, ConfigMap, Deployment, PodMonitor.

Resources on the lab: +96Mi request. Node requests are currently 4888Mi (77%) and dropping, since the lab cleanup is under way.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Rendered diff (as Argo CD renders: kustomize / Helm, against origin/main)

No change in the rendered manifests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MIERAI
MIERAI merged commit 5f70d23 into main Nov 23, 2026
2 checks passed
@MIERAI
MIERAI deleted the log-shipping-lab branch November 23, 2026 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant