infra(logging): Loki single-binary + Alloy DaemonSet, 192h bounded retention (F4)
No log store existed: pod logs were kubelet files on the node and died with the
pod (~8h deepest history for a busy workload). Adds:
- Loki 3.7.1 single-binary (1 Deployment + 8Gi local-path PVC on siriussec),
retention_period 192h with the compactor deleting on filesystem, ingest rate
limits, so the store is time- and rate-bounded.
- Alloy 1.13.0 DaemonSet (all nodes, no RBAC, no API access) shipping
/var/log/pods, /var/log/journal and the Pi's docker json logs. File sources
read from byte 0 and stamp the timestamp from the line, so the history the
nodes already held (18d cilium on linode, 31d registry on rpi) landed on day
one instead of starting the 7-day clock at deploy time.
- Grafana datasource (uid loki) via the existing sidecar, ServiceMonitor,
ingest-rate guard rule.
- docs/logging.md with the measured bytes/day, the 8-day projection and the
runbook.
Measured: ~360-502 MB/day raw -> ~90 MB/day compressed, 192h -> <=0.8GiB, on a
node with 103GiB free (house floor 32GiB). Verified 7-day-old lines return for
kube-system cilium-agent and for the siriussec/linode journals, and survive a
Loki pod restart (PVC).
2026-11-27 00:36:56 -05:00
|
|
|
# Grafana Alloy as a per-node collector.
|
|
|
|
|
#
|
|
|
|
|
# Runs on all three nodes (DaemonSet, tolerating rpi's
|
|
|
|
|
# dedicated=network:PreferNoSchedule and the control-plane taint set) because
|
|
|
|
|
# every node owns the logs of its own pods.
|
|
|
|
|
#
|
|
|
|
|
# No ServiceAccount, no ClusterRole: the config reads files only, so the
|
|
|
|
|
# default SA is all it needs. That is deliberately the smallest possible
|
|
|
|
|
# blast radius for a component that reads every log line in the cluster.
|
|
|
|
|
apiVersion: apps/v1
|
|
|
|
|
kind: DaemonSet
|
|
|
|
|
metadata:
|
|
|
|
|
name: alloy
|
|
|
|
|
namespace: logging
|
|
|
|
|
labels:
|
|
|
|
|
app.kubernetes.io/name: alloy
|
|
|
|
|
app.kubernetes.io/part-of: logging
|
|
|
|
|
spec:
|
|
|
|
|
selector:
|
|
|
|
|
matchLabels:
|
|
|
|
|
app.kubernetes.io/name: alloy
|
|
|
|
|
updateStrategy:
|
|
|
|
|
type: RollingUpdate
|
|
|
|
|
rollingUpdate:
|
|
|
|
|
maxUnavailable: 1
|
|
|
|
|
template:
|
|
|
|
|
metadata:
|
|
|
|
|
labels:
|
|
|
|
|
app.kubernetes.io/name: alloy
|
|
|
|
|
app.kubernetes.io/part-of: logging
|
|
|
|
|
spec:
|
|
|
|
|
tolerations:
|
|
|
|
|
- operator: Exists
|
|
|
|
|
# Reading /var/log/journal (0640 root:systemd-journal) and the kubelet
|
|
|
|
|
# log tree needs root; this is the same posture as node-exporter, which
|
|
|
|
|
# also reads host state. Dropped capabilities keep it unprivileged in
|
|
|
|
|
# practice — file reads need no capability.
|
|
|
|
|
securityContext:
|
|
|
|
|
runAsUser: 0
|
|
|
|
|
runAsGroup: 0
|
|
|
|
|
seccompProfile:
|
|
|
|
|
type: RuntimeDefault
|
|
|
|
|
containers:
|
|
|
|
|
- name: alloy
|
|
|
|
|
image: grafana/alloy:v1.13.0
|
|
|
|
|
imagePullPolicy: IfNotPresent
|
|
|
|
|
args:
|
|
|
|
|
- run
|
|
|
|
|
- /etc/alloy/config.alloy
|
|
|
|
|
- --server.http.listen-addr=127.0.0.1:12345
|
|
|
|
|
- --storage.path=/var/lib/alloy-data
|
|
|
|
|
- --disable-reporting
|
|
|
|
|
env:
|
|
|
|
|
- name: NODE_NAME
|
|
|
|
|
valueFrom:
|
|
|
|
|
fieldRef:
|
|
|
|
|
fieldPath: spec.nodeName
|
|
|
|
|
resources:
|
|
|
|
|
requests:
|
|
|
|
|
cpu: 30m
|
|
|
|
|
memory: 128Mi
|
|
|
|
|
limits:
|
|
|
|
|
cpu: 500m
|
|
|
|
|
memory: 512Mi
|
|
|
|
|
securityContext:
|
|
|
|
|
allowPrivilegeEscalation: false
|
|
|
|
|
readOnlyRootFilesystem: true
|
|
|
|
|
capabilities:
|
|
|
|
|
drop: ["ALL"]
|
|
|
|
|
volumeMounts:
|
|
|
|
|
- name: config
|
|
|
|
|
mountPath: /etc/alloy
|
|
|
|
|
readOnly: true
|
|
|
|
|
- name: podlogs
|
|
|
|
|
mountPath: /var/log/pods
|
|
|
|
|
readOnly: true
|
|
|
|
|
- name: journal
|
|
|
|
|
mountPath: /var/log/journal
|
|
|
|
|
readOnly: true
|
|
|
|
|
- name: machine-id
|
|
|
|
|
mountPath: /etc/machine-id
|
|
|
|
|
readOnly: true
|
|
|
|
|
- name: dockerlogs
|
|
|
|
|
mountPath: /var/lib/docker/containers
|
|
|
|
|
readOnly: true
|
infra(logging): ship kube-apiserver audit log with secret bodies stripped
t_104f62a6 made the apiserver audit log live on siriussec:
/var/log/kubernetes/audit/audit.log, mode 600 root, ~2.2 GB/day, rotated by the
apiserver itself (100 MB x 48, compressed). A pod-log collector never sees a
host file, so Alloy gets a read-only hostPath mount for that directory.
The file MUST NOT be shipped verbatim: at level=RequestResponse every
'get secrets' record carries responseObject.data — the plaintext secret.
The shipper therefore parses each record and re-emits a packed allowlist
(level, stage, verb, user, objectRef.*, responseStatus.code, sourceIPs[0],
userAgent, auditID, requestURI, requestReceivedTimestamp). requestObject and
responseObject never reach Loki; unparseable lines are dropped by stage.json
rather than passed through.
Nothing in that directory is written or pruned by the collector: the
apiserver's own 4.8 GB / 7-day rotation stays the only thing pruning it.
2026-11-27 00:49:07 -05:00
|
|
|
# kube-apiserver audit log (siriussec only). Read-only: the
|
|
|
|
|
# apiserver owns that directory and its rotation; the collector
|
|
|
|
|
# never writes to or prunes it.
|
|
|
|
|
- name: audit
|
|
|
|
|
mountPath: /var/log/kubernetes/audit
|
|
|
|
|
readOnly: true
|
infra(logging): Loki single-binary + Alloy DaemonSet, 192h bounded retention (F4)
No log store existed: pod logs were kubelet files on the node and died with the
pod (~8h deepest history for a busy workload). Adds:
- Loki 3.7.1 single-binary (1 Deployment + 8Gi local-path PVC on siriussec),
retention_period 192h with the compactor deleting on filesystem, ingest rate
limits, so the store is time- and rate-bounded.
- Alloy 1.13.0 DaemonSet (all nodes, no RBAC, no API access) shipping
/var/log/pods, /var/log/journal and the Pi's docker json logs. File sources
read from byte 0 and stamp the timestamp from the line, so the history the
nodes already held (18d cilium on linode, 31d registry on rpi) landed on day
one instead of starting the 7-day clock at deploy time.
- Grafana datasource (uid loki) via the existing sidecar, ServiceMonitor,
ingest-rate guard rule.
- docs/logging.md with the measured bytes/day, the 8-day projection and the
runbook.
Measured: ~360-502 MB/day raw -> ~90 MB/day compressed, 192h -> <=0.8GiB, on a
node with 103GiB free (house floor 32GiB). Verified 7-day-old lines return for
kube-system cilium-agent and for the siriussec/linode journals, and survive a
Loki pod restart (PVC).
2026-11-27 00:36:56 -05:00
|
|
|
# NOT /var/lib/alloy/...: that path is 0770 alloy:alloy in the
|
|
|
|
|
# image, and this pod drops ALL capabilities (so root has no
|
|
|
|
|
# CAP_DAC_OVERRIDE) — traversal of the parent is denied. /var/lib
|
|
|
|
|
# is world-traversable, so the positions live here instead.
|
|
|
|
|
- name: data
|
|
|
|
|
mountPath: /var/lib/alloy-data
|
|
|
|
|
- name: tmp
|
|
|
|
|
mountPath: /tmp
|
|
|
|
|
terminationGracePeriodSeconds: 30
|
|
|
|
|
volumes:
|
|
|
|
|
- name: config
|
|
|
|
|
configMap:
|
|
|
|
|
name: alloy-config
|
|
|
|
|
- name: podlogs
|
|
|
|
|
hostPath:
|
|
|
|
|
path: /var/log/pods
|
|
|
|
|
- name: journal
|
|
|
|
|
hostPath:
|
|
|
|
|
path: /var/log/journal
|
|
|
|
|
- name: machine-id
|
|
|
|
|
hostPath:
|
|
|
|
|
path: /etc/machine-id
|
|
|
|
|
type: File
|
|
|
|
|
# Only the Pi runs Docker containers outside the cluster (registry,
|
|
|
|
|
# Garage). On the other nodes this path does not exist and the file
|
|
|
|
|
# match simply yields nothing; `DirectoryOrCreate` keeps the mount from
|
|
|
|
|
# blocking the DaemonSet rollout there.
|
|
|
|
|
- name: dockerlogs
|
|
|
|
|
hostPath:
|
|
|
|
|
path: /var/lib/docker/containers
|
|
|
|
|
type: DirectoryOrCreate
|
infra(logging): ship kube-apiserver audit log with secret bodies stripped
t_104f62a6 made the apiserver audit log live on siriussec:
/var/log/kubernetes/audit/audit.log, mode 600 root, ~2.2 GB/day, rotated by the
apiserver itself (100 MB x 48, compressed). A pod-log collector never sees a
host file, so Alloy gets a read-only hostPath mount for that directory.
The file MUST NOT be shipped verbatim: at level=RequestResponse every
'get secrets' record carries responseObject.data — the plaintext secret.
The shipper therefore parses each record and re-emits a packed allowlist
(level, stage, verb, user, objectRef.*, responseStatus.code, sourceIPs[0],
userAgent, auditID, requestURI, requestReceivedTimestamp). requestObject and
responseObject never reach Loki; unparseable lines are dropped by stage.json
rather than passed through.
Nothing in that directory is written or pruned by the collector: the
apiserver's own 4.8 GB / 7-day rotation stays the only thing pruning it.
2026-11-27 00:49:07 -05:00
|
|
|
- name: audit
|
|
|
|
|
hostPath:
|
|
|
|
|
path: /var/log/kubernetes/audit
|
|
|
|
|
type: DirectoryOrCreate
|
infra(logging): Loki single-binary + Alloy DaemonSet, 192h bounded retention (F4)
No log store existed: pod logs were kubelet files on the node and died with the
pod (~8h deepest history for a busy workload). Adds:
- Loki 3.7.1 single-binary (1 Deployment + 8Gi local-path PVC on siriussec),
retention_period 192h with the compactor deleting on filesystem, ingest rate
limits, so the store is time- and rate-bounded.
- Alloy 1.13.0 DaemonSet (all nodes, no RBAC, no API access) shipping
/var/log/pods, /var/log/journal and the Pi's docker json logs. File sources
read from byte 0 and stamp the timestamp from the line, so the history the
nodes already held (18d cilium on linode, 31d registry on rpi) landed on day
one instead of starting the 7-day clock at deploy time.
- Grafana datasource (uid loki) via the existing sidecar, ServiceMonitor,
ingest-rate guard rule.
- docs/logging.md with the measured bytes/day, the 8-day projection and the
runbook.
Measured: ~360-502 MB/day raw -> ~90 MB/day compressed, 192h -> <=0.8GiB, on a
node with 103GiB free (house floor 32GiB). Verified 7-day-old lines return for
kube-system cilium-agent and for the siriussec/linode journals, and survive a
Loki pod restart (PVC).
2026-11-27 00:36:56 -05:00
|
|
|
- name: data
|
|
|
|
|
hostPath:
|
|
|
|
|
path: /var/lib/alloy-data
|
|
|
|
|
type: DirectoryOrCreate
|
|
|
|
|
- name: tmp
|
|
|
|
|
emptyDir: {}
|