Repository navigation
Description
Problem
Three charts run defaults that the repo's values never turned off. Together they write about 140 MB a day to Loki's volume (plus Loki's own lines about the canary) and keep a cluster-wide watch on Secrets, and nobody reads any of it. Checked live on 2026-10-03.
Loki canary (chart loki 7.3.0). k8s/logging/loki-values.yaml has no lokiCanary key. The chart defaults are enabled: true, kind DaemonSet and push: true, and helm get values loki -a confirms them. logging/loki-canary runs 4/4.
- Direct pushes: 4 streams
{pod=loki-canary-*, service_name="unknown_service", stream="stdout"}, 295,742 lines and 29.6 MB in 24h. - Its stderr ("Querying loki for logs with query: ...") reaches Loki again through
alloy-logsasjob="logging/loki-canary": 84,493 lines and 16.9 MB in 24h. These are not duplicates of the entries; they are diagnostics. - Loki's own container logged 595,697 lines in 24h, and 321,376 of them mention
canary. - Nothing reads the canary's metrics. There are no
loki_canary_*series now or over 30 days, no ServiceMonitor or annotation selects it, and no rule references it. The logging policy admitsmonitoringon 3100 only, not on the canary's metrics port 3500. - feat(k8s): alert when pod logs stop reaching loki #890 already notes the canary "measures Loki, not the shipper".
Pyroscope runs at debug (chart pyroscope 2.3.1). helm show values grafana/pyroscope --version 2.3.1 sets pyroscope.extraArgs: {log.level: debug}. k8s/monitoring/pyroscope-values.yaml sets no log level, and the live container args include -log.level=debug.
- 24h of
job="monitoring/pyroscope": 368,993 lines and 91.2 MB. Of those, 335,243 are debug, 33,452 info, 206 warn and 35 error. - It is the third-largest job by bytes, after Loki itself and fluent-bit (fix(k8s): pod logs reach loki once and labelled, with alloy as the only shipper (remove fluent-bit) #548).
Grafana's datasource sidecar watches for objects that don't exist (chart grafana 10.5.15). k8s/monitoring/grafana-values.yaml:115-116 sets sidecar.datasources.enabled: true, but all five datasources are provisioned inline (lines 44-83).
kubectl get cm,secret -A -l grafana_datasourcereturns nothing, and no file under k8s/, src/ or tests/ produces that label.- The
grafana-sc-datasourcescontainer still runsMETHOD=WATCH,RESOURCE=both, with the admin credentials mounted for its reload call. Its only output is "Loading incluster config..." twice a minute: 2,930 lines a day. - Because a sidecar is enabled and
rbac.namespacedis unset, the chart renders a ClusterRole withget/watch/listonconfigmapsandsecretsin every namespace. The livegrafana-clusterrolegrants exactly that. - The dashboards sidecar adds to it with
searchNamespace: ALLand the chart defaultresource: both, although every dashboard ConfigMap lives inmonitoring(k8s/monitoring/dashboards/kustomization.yaml). - Datasource provisioning doesn't depend on the sidecar. The inline file is mounted from the chart's own ConfigMap at
/etc/grafana/provisioning/datasources/datasources.yaml.
Loki warns on every query that deletion is unavailable (found 2026-10-03, after #550). k8s/logging/loki-values.yaml keeps compactor.retention_enabled: true with delete_request_store: filesystem, which Loki 3 requires for retention, and closes the delete API with limits_config.deletion_mode: disabled (#550; the API would accept unauthenticated requests while auth_enabled is false). With that pair, Loki logs a deletion is not available for this tenant warning on every query, so each Grafana panel refresh adds lines to Loki's own log that say nothing new.
Loki admits the whole monitoring namespace. k8s/logging/networkpolicy.yaml:23-36 admits port 3100 from any pod in monitoring (a namespace-only peer) and only the collector's pods from otel (#1100). Loki runs with auth disabled, so any monitoring workload can push or query. Only Grafana (queries) and the k8s-monitoring Alloy collectors (alloy-logs pushes; alloy-metrics scrapes Loki once #1130 adds integrations.loki) need it. The narrowing was raised in #1100's review.
Acceptance criteria
-
k8s/logging/loki-values.yamlsetslokiCanary.enabled: false, with a comment that pipeline liveness comes from Alloy's series (feat(k8s): the alloy collectors, grafana and pyroscope are scraped through chart integrations, and a dropped sample or log entry alerts #1131, feat(k8s): alert when pod logs stop reaching loki #890). - A Loki query no longer logs
deletion is not available for this tenant, and the delete API stays closed:deletion_modestaysdisabled, and retention still runs (compactor.retention_enabled: true). The PR names the Loki setting that stops the per-query lookup, citing the Loki 3.x documentation or source for the deployed chart's appVersion, and a values test pins it withdeletion_mode. - Loki's ingress peer from
monitoringink8s/logging/networkpolicy.yamlnames Grafana's pods and the k8s-monitoring Alloy collectors by their chart labels, in the combined namespace-and-pod peer form fix(security): Loki admits only the OpenTelemetry collector from otel, and persona exemplars always come from the review target's project #1100 uses for the otel collector, instead of the whole namespace. A policy test pins the peer set for port 3100, and fails if a namespace-onlymonitoringpeer returns. -
k8s/monitoring/pyroscope-values.yamlsetspyroscope.extraArgs.log.level: info. Helm deep-merges maps, so the chart's otherextraArgskeys stay. -
k8s/monitoring/grafana-values.yamlhas the following:sidecar.datasources.enabled: false;sidecar.dashboards.searchNamespace: monitoringandsidecar.dashboards.resource: configmap;rbac.namespaced: true, so the chart renders a Role inmonitoringinstead of a ClusterRole.
- A test asserts, as one structural tuple:
lokiCanary.enabled;- Pyroscope's
log.level; - the Grafana datasource sidecar flag;
- the dashboard sidecar's
searchNamespaceandresource; rbac.namespaced;- that every
grafana_dashboard-labelled ConfigMap the kustomizations generate is inmonitoring.
- A test fails if any values file under
k8s/sets a log level ofdebug. It checks anylog.level/logLevel/log_levelkey or-log.level=debugargument, in any values file the stack lifecycle installs. Verified by a mutation in review: setting Pyroscope's level back todebugmust make it fail. - No test reaches the network. Each new test's call phase is under 1 s. A
changelog.d/<n>.mdfragment exists; CHANGELOG.md and docs/ROADMAP.md are untouched. - Pending a person, after the infra and logging stacks are redeployed:
kubectl get ds -n logginglists noloki-canary;kubectl get clusterrole grafana-clusterrolereturns NotFound;kubectl get role -n monitoring grafana -o jsonpath='{.rules}'grantsconfigmaps;- Grafana still lists all five datasources and every provisioned dashboard, and the Loki datasource passes "Save & test";
alloy-logslogs no Loki write errors, and new log lines keep arriving;- over 1h, Loki's own log has no
deletion is not available for this tenantline; - 24h later,
sum by (job) (bytes_over_time({job=~"monitoring/pyroscope|logging/loki-canary|monitoring/grafana-sc-datasources"}[24h]))(Loki) is under 10 MB in total, and{service_name="unknown_service"}has no new lines; - also pending a person:
kubectl delete clusterrolebinding grafana-clusterrolebindingandkubectl delete clusterrole grafana-clusterrole, if Helm leaves either behind (it should remove both).
Key questions
-
Disable the canary or wire it up? Proposed: disable it. It measures Loki's write and read path from inside the logging namespace, and nothing scrapes it or alerts on it. Wiring it up would take four changes: a scrape annotation, a policy rule for 3500, an alert, and a quieter log level. Pipeline liveness, the failure that matters, is feat(k8s): alert when pod logs stop reaching loki #890's alert on Alloy's
loki_write_sent_entries_total(feat(k8s): the alloy collectors, grafana and pyroscope are scraped through chart integrations, and a dropped sample or log entry alerts #1131). If feat(k8s): alert when pod logs stop reaching loki #890 later wants a write and read probe, it re-enables the canary withpush: falseand the four changes. -
Does this conflict with fix(k8s): pod logs reach loki once and labelled, with alloy as the only shipper (remove fluent-bit) #548? Proposed: yes, in one criterion. fix(k8s): pod logs reach loki once and labelled, with alloy as the only shipper (remove fluent-bit) #548 expects "only
loki-0andloki-canary-*pods" inloggingafter fluent-bit is gone. fix(k8s): pod logs reach loki once and labelled, with alloy as the only shipper (remove fluent-bit) #548 is amended to accept either state, so the two items can merge in any order. -
infoorwarnfor Pyroscope? Proposed:info. It is about 33k lines a day and keeps the info-level start-up, compaction and segment messages that feat(k8s): profiles come from k8s-monitoring's profiling feature for every workload, and the profiling dashboards list what is profiled #1134's torn-segment diagnosis needs.warndrops them. -
Is
rbac.namespaced: truesafe with the dashboards sidecar? Proposed: yes. Every dashboard ConfigMap is generated intomonitoring, and the chart's Role template grantsconfigmaps/secretsin its own namespace whenever a sidecar is enabled. The structural test pins the namespace, so a ConfigMap generated elsewhere fails the gate instead of silently not loading. -
Why fold the two Loki changes in here? Proposed: both are Loki chart-values and policy settings found on 2026-10-03 (the warning after Metrics and logs are kept for two hours #550, the peer in fix(security): Loki admits only the OpenTelemetry collector from otel, and persona exemplars always come from the review target's project #1100's review). This item already edits
k8s/logging/loki-values.yamland checks Loki's log volume, so one deploy and one check cover them. -
Which pods does the narrowed peer name? Proposed: Grafana and the three k8s-monitoring Alloy collectors (
alloy-logs,alloy-metrics,alloy-singleton), matched byapp.kubernetes.io/nameandapp.kubernetes.io/instanceas the chart labels them. If feat(k8s): alert when pod logs stop reaching loki #890 later re-enables the canary, its port 3500 rule is its own.
Strategic alignment
- P2 fix: about 140 MB a day of unread Loki writes on a volume sized for 30 days (Metrics and logs are kept for two hours #550), a 4-pod DaemonSet, and a cluster-wide Secret read grant that serves no producer.
- Value: medium (Loki headroom, less RBAC exposure). Effort: S (three values files, two tests).
- Library-first: chart flags only.
- Related: fix(k8s): pod logs reach loki once and labelled, with alloy as the only shipper (remove fluent-bit) #548 (amended canary criterion), feat(k8s): alert when pod logs stop reaching loki #890 (pipeline liveness owner), feat(cli): devops-cli dashboards chart the metrics the cli sends and the grafana sidecar provisions them #692 (the dashboards sidecar's origin), feat(k8s): integrate grafana pyroscope to the monitoring stack #943/feat(k8s): expose pyroscope ui endpoints, port-forwarding and grafana dashboards #977 (Pyroscope), Metrics and logs are kept for two hours #550 (volume sizing), Disable third-party telemetry and phone-home across k8s stack and devcontainer #803 (chart defaults review precedent), feat(k8s): the alloy collectors, grafana and pyroscope are scraped through chart integrations, and a dropped sample or log entry alerts #1131 (Alloy series that replace the canary's role).
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Oct 18, 2026
Update 2026-10-18 from a read-only cluster audit (main 3dd7fa6). Four facts change or extend this item's criteria.
1. No Loki setting stops the per-query cache-generation lookup, so the Loki criterion cannot be met as written.
pkg/loki/modules.goadds the frontend'sCacheGenNumberHeaderSetterMiddlewareand the querier'sCacheGenNumberContextSetterMiddlewarewheneversupportIndexDeleteRequest()andcompactor.retention_enabledare both true.deletion_modeand the results-cache setting are never checked.pkg/compactor/deletion/grpc_request_handler.goGetCacheGenNumbersreturns an error for a tenant without deletion, andgenerationnumber/gennumber_loader.gocaches only successes, so every request asks again. Upstream Error messages seen when deletion_mode is disabled with runtime configuration grafana/loki#9855 (2023-07-04) is still open with no linked PR.level=error caller=gennumber_loader.go:136 msg="error loading cache generation numbers" err="... deletion is not available for this tenant"pluslevel=warn method=/grpc.Compactor/GetCacheGenNumbers. On an ordinary day (2026-10-16) that was about 172k of each, 40% of Loki's own lines and 18.9% of all 1.82M lines ingested. 213,950 of about 214,200 Loki error lines in 24h come from that one caller, so alevel=errorsearch on Loki is useless today.LokiRequestErrors(k8s/monitoring/prometheus-values.yaml:414) cannot see it: the gRPC route reportsstatus_code="error", not 5xx;loki_request_duration_seconds_count{route="/grpc.Compactor/GetCacheGenNumbers",status_code="error"}runs at about 2/s.deletion_mode: disabledand retention, and drop exactly these two literal messages at the collector. k8s-monitoring 4.5.2'spodLogsViaLokifeature exposesextraLogProcessingStages: astage.matchfor{namespace="logging", container="loki"}with twostage.dropstages on the literal messages, a comment citing Error messages seen when deletion_mode is disabled with runtime configuration grafana/loki#9855, a test intests/test_k8s.py, and removal once upstream fixes it. Verification:sum(count_over_time({namespace="logging",container="loki"} |= "deletion is not available for this tenant" [1h]))is 0. The gRPC error counter keeps rising, so it cannot be the check.2. Pyroscope also needs its usage-reporting opt-out, in the same
extraArgsmap.monitoring/pyroscope(2.3.1) has no usage-stats flag, andpyroscope-configis{}. It is the only Grafana component without an opt-out: Loki (loki-values.yaml:9-10), Grafana (grafana-values.yaml:38-39), the k8s-monitoring Alloys (k8s-monitoring-values.yaml:271,284,297) and Tempo (tempo-values.yaml:8) all have one. That breaks AGENTS.md's mandatory opt-out rule, anddocs/agent/tasks/task-943-...md:35wrongly records "telemetry disabled".-architecture.storage=v2the pod is a reporter follower (pkg/pyroscope/modules.go:602-610), so it waits forever for a seed file (pkg/usagestats/reporter.go:173-183) and sends nothing. It does logcaller=reporter.go ... failed to read cluster seed file1,882 times a day. An upgrade that changes leader selection would start reports through monitoring's open 443 egress.usage-stats.enabled: "false"next tolog.level: info.helm templateof chart 2.3.1 renders-usage-stats.enabled=falsewith the chart's other args unchanged (flag registered atreporter.go:49). Pin it intests/test_third_party_telemetry.py, correct task-943's line, and add a pending-a-person check that|= "caller=reporter.go"returns nothing over 1h.3.
rbac.namespaced: truestill leaves a Secret grant.templates/role.yamlhard-codesresources: ["configmaps", "secrets"]whenever any sidecar is enabled, whateversidecar.*.resourcesays. With this item's values,helm templaterenders only a Role and RoleBinding, but Grafana keeps get/list/watch on Secrets inmonitoring. Today that isgrafana-admin; feat(k8s): alertmanager posts critical and warning alerts to mattermost's alerts channel, and a roadmap service repository whose rounds all fail for an hour alerts #1392 addsalertmanager-webhookthere.grafana-ingress. Livekubectl auth can-iconfirms reads of Secrets in llm, cloudflared, devops and argocd today (names only checked).rbac.useExistingRolewith a repo-owned configmaps-only Role. Re-check the template after the Grafana move to the grafana-community chart (filed separately), which may differ.4. Current canary figures. 3 pods (two Node objects were removed): 259,200 pushed lines and 76,988 stdout lines a day.
dan-petty commentedon Oct 21, 2026
What changed
#1781, merged into
release/v0.2.38as a3a345c.7 file(s) changed.
How it was verified
Check runs at 5235af0:
No task file.
fix(k8s): loki runs from the grafana-community chart on loki 3.7.9, o…