Skip to content

fix(k8s): k8s-monitoring collectors run in the chart's preset shapes, and node-exporter keeps the series the node dashboards read #1129

Closed

Description

@dan-petty

Problem

Four settings in k8s/monitoring/k8s-monitoring-values.yaml (k8s-monitoring 4.5.2) don't do what the file, or the change that set them, says they do. All four are chart features that already exist. The repo either sets them the wrong way or leaves them unset. Checked live and against the chart source on 2026-10-03.

1. node-exporter's allow list was narrowed, not widened (a regression from #922/#923). 0778f60 (#923) changed hostMetrics.linuxHosts.metricsTuning.useIntegrationAllowList from true to false "to preserve host disk and network metrics". The chart works the other way round. charts/feature-host-metrics/templates/_linux_hosts.alloy.tpl concatenates three lists:

  • default-allow-lists/node-exporter.yaml when useDefaultAllowList is set (on by default; 12 entries: node_cpu.*, node_filesystem.*, node_memory.*, four network byte and drop counters, build info and process_*);
  • default-allow-lists/node-exporter-integration.yaml (157 entries), only when useIntegrationAllowList is true;
  • includeMetrics.

So false removes the 157-entry list. The node-exporter pods still expose node_load1, node_disk_io_now and the rest (read through the pod proxy), so the allow list is what drops them. In Prometheus, the last sample of node_load1, node_uname_info, node_context_switches_total and node_disk_read_bytes_total is at 2026-10-02 04:14:53Z to 04:15:38Z on every node. The k8s-monitoring-alloy-* releases moved to revision 2 at 04:15:46Z.

  • k8s/monitoring/dashboards/k8s-views-nodes.json queries 22 node_* series that Prometheus no longer has: context switches, disk I/O now, disk read/written bytes, disk reads/writes completed, file descriptors allocated/maximum, interrupts, load 1/5/15, node_netstat_Tcp_CurrEstab, network receive/transmit errors and packets, conntrack entries and limit, timex estimated error and max error, and node_uname_info.
  • 20 of the 22 are in the integration list. node_disk_io_now and node_netstat_Tcp_CurrEstab are in no chart list.
  • "Node Exporter Full" (gnetId 1860, provisioned from grafana-values.yaml) builds both its $job and $node variables from label_values(node_uname_info, ...), so the whole dashboard shows no data.
  • None of the fix(monitoring): alerts reach an Alertmanager, and homelab rules cover nodes, GPUs, storage and the stack without k3s false positives (#549) #1094 alert rules in prometheus-values.yaml uses a missing series.

2. alloy-singleton runs as a 4-pod DaemonSet. collectors.alloy-singleton sets only alloy.enableReporting and resources, with no presets. The block has had none since it was introduced; UPGRADING.md shows alloy-singleton: {} as its v4 example. The chart's collectors/presets/singleton.yaml (controller.type: deployment, replicas: 1) is what makes a collector a singleton. Without it, the Alloy chart's default applies, which is a DaemonSet.

  • Live: daemonset.apps/k8s-monitoring-alloy-singleton is 4/4, one pod per node. The Alloy CR k8s-monitoring-alloy-singleton has no spec.controller.type, while alloy-metrics is a statefulset with 1 replica and alloy-logs is a daemonset.
  • clusterEvents (collector alloy-singleton, clustering unset) runs loki.source.kubernetes_events "cluster_events" in every pod. charts/feature-cluster-events/values.yaml says that without clustering the feature "should run on a singleton collector".
  • Per-pod loki_write_sent_entries_total, read on :12345: 1640, 1731, 1668 and 74 (the last pod had restarted 84 minutes earlier). Each pod ships the whole event stream.
  • Over 6h, Loki processed 452 eventhandler lines and returned 349. It drops entries with an identical stream, timestamp and line, which hides the duplicates. The cost is 4 API-server event watches, 4 pushes of every event, and 4 x (50m CPU, 128Mi) in requests.
  • The alloy-events-ingress Ingress (k8s/ingress/ingress-routes.yaml) load-balances across 4 different Alloy UIs.

3. Every Alloy-written series carries the cluster name twice. The chart's prometheus destination defaults to clusterLabels: [cluster, k8s.cluster.name] (destinations/prometheus-values.yaml:66). The rendered prometheus.remote_write "localprometheus" therefore adds both cluster and k8s_cluster_name. Every dashboard and rule keys on cluster only. Under k8s/ and src/, git grep k8s_cluster_name finds the label only in two capture fixtures (tests/fixtures/metrics/dcgm-exporter.yaml, litellm.yaml).

4. One kube-state-metrics allow-list entry can never match. clusterMetrics.kube-state-metrics.metricsTuning.includeMetrics lists kube_hpa_labels (line 55), a kube-state-metrics v1 name. The deployed KSM is v2.20.0, which serves only kube_horizontalpodautoscaler_*. The chart's default KSM allow list already carries kube_horizontalpodautoscaler_*. The dashboards that query the old name are fixed in #1136.

Two tests pin the regression: tests/test_k8s_monitoring_integration.py:78-82 and :135-141 assert useIntegrationAllowList is False, and :70 requires kube_hpa_labels.

Update 2026-10-08: item 1 is re-scoped from "widen the allow list" to "no allow list on node-exporter". #1175 (v0.2.26) set useIntegrationAllowList: true and added node_disk_io_now, node_netstat_Tcp_CurrEstab, node_uname_info and node_load.* to includeMetrics. Node Exporter Full's variables work again, but the dashboard still shows gaps:

  • It queries 208 metric names. The live keep regex of the integrations/node_exporter job matches 159.
  • 38 of the other 49 are served by node-exporter (read through the pod proxy on one node) and dropped by the keep rule: node_procs_blocked, node_forks_total, node_schedstat_*, node_entropy_available_bits, node_scrape_collector_{duration_seconds,success}, node_systemd_units, node_disk_{reads,writes}_merged_total, node_disk_discard*, node_hwmon_temp_{crit,crit_alarm,max}_celsius, node_cooling_device_*, node_power_supply_online, node_timex_{loop_time_constant,frequency_adjustment_ratio,tick_seconds,tai_offset_seconds}, node_netstat_Tcp_{ActiveOpens,PassiveOpens}, node_netstat_Ip_Forwarding, node_netstat_TcpExt_{TCPRcvQDrop,TCPOFOQueue,Syncookies*}, node_network_{receive_frame,transmit_carrier,transmit_colls}_total, node_sockstat_FRAG_memory, process_virtual_memory{,_max}_bytes.
  • The remaining 11 are not served: node_processes_* (processes collector, off by default), node_interrupts_total (interrupts, off), node_tcp_connection_states (tcpstat, off), node_systemd_socket_accepted_connections_total (the systemd collector reports only the host service units), and names this kernel, hardware or node-exporter version does not serve (node_netstat_Tcp_MaxConn, node_hwmon_temp_crit_hyst_celsius, process_resident_memory_max_bytes).
  • The flag has flipped in three releases (v0.2.24 true, v0.2.25 false, v0.2.26 true), each time adding a few names. An allow list cannot track a third-party dashboard, and node-exporter's collector flags already decide what is collected.
  • In the chart template, useDefaultAllowList: false, useIntegrationAllowList: false and an empty includeMetrics render no keep rule (_linux_hosts.alloy.tpl: the keep block is guarded by if $metricAllowList). The filesystem-type drop rule stays.
  • Cost, measured 2026-10-08: node-exporter serves 8,057 series across the four nodes and the keep rule passes 4,528, so about 3.5k more head series. Prometheus head: 78.6k. fix(k8s): the prometheus server scrapes only itself and the otel collector, and k8s-monitoring discovers every other target #1130 removes about 50k.

Acceptance criteria

  • hostMetrics.linuxHosts.metricsTuning sets useDefaultAllowList: false and useIntegrationAllowList: false and has no includeMetrics, so the integrations/node_exporter job keeps every series node-exporter serves. The comment says that node-exporter's collector flags (telemetryServices.node-exporter.extraArgs) decide what is collected, and why there is no allow list (see the 2026-10-08 update). The feat(monitoring): homelab hosts send their journals to Loki and their health metrics to Prometheus #1080 names stay covered, because node-exporter serves them all.
  • collectors.alloy-singleton.presets: [singleton].
  • destinations.localPrometheus.clusterLabels: [cluster].
  • kube_hpa_labels is removed from the KSM includeMetrics.
  • A test rebuilds the effective keep list the way _linux_hosts.alloy.tpl does (default list if useDefaultAllowList, which defaults to true; then the integration list if useIntegrationAllowList; then includeMetrics) and asserts that it is empty. It does not need the chart's list contents, so no list fixture is checked in.
    • Verified by the test passing, and by a one-time mutation in review: removing useDefaultAllowList: false (the chart default is true) must make it fail.
  • A test asserts, as one structural tuple:
    • every collector under collectors names exactly one controller preset out of singleton, daemonset, statefulset and deployment;
    • the collector assigned to clusterEvents uses singleton while clusterEvents.clustering is unset or false.
    • Verified by a mutation in review: removing presets from alloy-singleton must make it fail.
  • tests/test_k8s_monitoring_integration.py expects True at both places that pin the allow-list flag, and no longer requires kube_hpa_labels. Any fixture or test that compares Alloy series labels drops k8s_cluster_name.
  • No test reaches the network or runs helm. Each new test's call phase stays under 1 s (uv run pytest tests/test_k8s_monitoring_integration.py --durations=10), and uv run devops ci passes within its 5-minute budget.
  • changelog.d/<n>.md exists. CHANGELOG.md and docs/ROADMAP.md are untouched (uv run devops pr check-readiness passes).
  • Pending a person, after merge (applied by uv run devops k8s deploy-stack --stack infra, or by feat(k8s): argo cd keeps the homelab cluster at the current release branch, with automated sync, prune and self-heal that never delete data #755's Application once it exists):
    kubectl get deploy,ds -n monitoring | grep alloy-singleton
    
    Expected: deployment.apps/k8s-monitoring-alloy-singleton 1/1 and no DaemonSet of that name. Then, in Grafana Explore against Prometheus, 10 minutes later:
    • count(node_uname_info) equals the node count;
    • count({__name__=~"node_load1|node_context_switches_total|node_netstat_Tcp_CurrEstab|node_disk_io_now"}) by (__name__) returns all four names;
    • count(count_over_time({k8s_cluster_name!=""}[5m])) is empty;
    • Node Exporter Full shows data for every node, in every panel except the processes, interrupts and TCP connection-state panels (collectors off by default) and panels for hardware a node lacks;
    • count by (__name__) ({__name__=~"node_procs_blocked|node_forks_total|node_scrape_collector_success|node_systemd_units", job="integrations/node_exporter"}) returns all four names.

Key questions

  • Why no allow list instead of a wider one? Decided 2026-10-08 (re-scope): the integration list still drops 38 of the names Node Exporter Full reads, and each release that widened or narrowed the list left a different set of panels empty. The chart renders no keep rule when all three sources are empty, and node-exporter's collector flags remain the one place that decides what is collected.
  • What does no allow list cost? Proposed: accept it. About 3.5k more head series across four nodes (8,057 served against 4,528 kept on 2026-10-08), against a 78.6k head. fix(k8s): the prometheus server scrapes only itself and the otel collector, and k8s-monitoring discovers every other target #1130 removes about 50k head series from the unused API-server job, which is far more than this adds.
  • Should the processes, interrupts or tcpstat collectors be turned on for the remaining empty panels? Proposed: no, not in this item. interrupts is per IRQ per CPU, and node-exporter's own docs warn that tcpstat has performance issues under load. processes is cheap, so it can be a follow-up if its panels are wanted.
  • Should the gate render the chart with helm template? Proposed: no. The gate never reaches the network and has a 5-minute budget, and the chart isn't vendored. The fixture copies the two lists from the pinned chart version. When feat(k8s): argo cd keeps the homelab cluster at the current release branch, with automated sync, prune and self-heal that never delete data #755 pins version per release, a test asserts that the fixture header's version equals the k8s-monitoring pin, so a chart bump forces a fixture refresh.
  • Does switching the singleton from a DaemonSet to a Deployment lose or duplicate events? Proposed: no loss that matters. The new pod starts a fresh watch. Events re-sent with an identical timestamp and line are dropped by Loki, as they are today, and nothing alerts on event volume.
  • node_disk_io_now and node_netstat_Tcp_CurrEstab, which no chart list has? With no allow list they need no entry. fix(k8s): the kubernetes, node and ingress dashboards query only series something serves, checked against captured exporter families and the chart allow lists #1136 fixes the rate() applied to the node_disk_io_now gauge.
  • Does dropping k8s_cluster_name break anything? Proposed: no. No dashboard, rule or CLI query reads it, and existing series age out under the 30-day retention.

Strategic alignment

Update 2026-10-08: refinement

The test criterion contradicts the re-scope. It becomes: the cAdvisor test (tests/test_k8s_monitoring_integration.py:29-84) no longer reads useIntegrationAllowList or requires kube_hpa_labels, and the host-metrics test (:129) asserts both flags False with no includeMetrics. No list fixture is checked in; #1131 and #1136 add theirs.

Activity

  1. added
    scope/k8s
    scope/telemetry
    priority/p1-high
    on Oct 3, 2026
  2. added this to the v0.2.32 milestone on Oct 9, 2026
  3. dan-petty-bot commented on Oct 9, 2026

    @dan-petty-bot
    Collaborator

    Moved to v0.2.32: v0.2.32 started with fewer than its 12 items and was topped up to 12 from Ready items, critical fixes and P0 features first. (devops roadmap reprioritize)

  4. dan-petty-bot commented on Oct 9, 2026

    @dan-petty-bot
    Collaborator

    What changed

    #1500, merged into release/v0.2.32 as 48410de.

    Summary

    • No node-exporter allow list. hostMetrics.linuxHosts.metricsTuning sets useDefaultAllowList: false and useIntegrationAllowList: false with no includeMetrics, so the chart writes no keep rule. Prometheus keeps every series node-exporter serves, and node-exporter's collector flags (telemetryServices.node-exporter.extraArgs) decide what is collected. The chart's ramfs/tmpfs filesystem drop stays, and the feat(monitoring): homelab hosts send their journals to Loki and their health metrics to Prometheus #1080 host-failure series still come through.
    • alloy-singleton runs as one pod. collectors.alloy-singleton.presets: [singleton] makes it a one-replica Deployment instead of a DaemonSet with a pod per node, so Kubernetes events are watched and shipped once.
    • Cluster name written once. destinations.localPrometheus.clusterLabels: [cluster] drops the duplicate k8s_cluster_name label from Alloy-written series.
    • kube_hpa_labels removed from the kube-state-metrics allow list; kube-state-metrics v2 never serves it.
    • Tests:
      • the host-metrics test rebuilds the keep sources the way _linux_hosts.alloy.tpl does and asserts they are empty;
      • new test_each_alloy_collector_runs_in_one_controller_preset and test_alloy_writes_the_cluster_name_once;
      • the cAdvisor/KSM test no longer reads the allow-list flag or requires kube_hpa_labels;
      • the LiteLLM and DCGM capture fixtures drop k8s_cluster_name.
    • Docs: the k8s/README.md Host Journals bullet is rewritten, and task-1080, task-1175 and task-693 get "since fix(k8s): k8s-monitoring collectors run in the chart's preset shapes, and node-exporter keeps the series the node dashboards read #1129" note…

    11 file(s) changed.

    How it was verified

    Check runs at 8ef1cc1:

    • Prune PR DevContainer Images: pass
    • CodeQL: pass
    • Analyze (python): pass
    • Tests & Coverage: pass
    • Static Analysis: pass
    • Analyze (actions): pass
    • DevContainer Image: skipping
    • Service Image: skipping
    • Dependency Freshness: skipping

    Acceptance Criteria of docs/agent/tasks/task-1129-k8s-monitoring-presets-and-node-exporter-series.md:

    • hostMetrics.linuxHosts.metricsTuning sets useDefaultAllowList: false and useIntegrationAllowList: false and has no includeMetrics, with a comment saying that node-exporter's collector flags (telemetryServices.node-exporter.extraArgs) decide what is collected and why there is no allow list. test_host_metrics_keep_the_series_that_explain_a_host_failure rebuilds the keep sources the way _linux_hosts.alloy.tpl concatenates them (default list unless useDefaultAllowList is false, integration list when useIntegrationAllowList is true, then includeMetrics), without the lists' contents, and asserts they are empty alongside the unchanged node-exporter arguments and D-Bus address. No list fixture is checked in.
    • Review mutation: removing useDefaultAllowList: false (the chart default is true) fails test_host_metrics_keep_the_series_that_explain_a_host_failure with keep sources ['default'].
    • collectors.alloy-singleton.presets: [singleton]. test_each_alloy_collector_runs_in_one_controller_preset asserts, as one tuple, that each collector names exactly one of the controller presets singleton, daemonset, statefulset and deployment, and that the clusterEvents collector uses singleton while clusterEvents.clustering is unset or false.
    • Review mutation: removing presets from alloy-singleton fails test_each_alloy_collector_runs_in_one_controller_preset.
    • destinations.localPrometheus.clusterLabels: [cluster], pinned by test_alloy_writes_the_cluster_name_once; deleting the line fails it.
    • kube_hpa_labels is removed from the KSM includeMetrics. The refinement of 2026-10-08 replaced the criterion that expected True at both places pinning the allow-list flag: test_k8s_monitoring_cadvisor_and_ksm_metrics_tuning no longer reads useIntegrationAllowList or requires kube_hpa_labels, and the host-metrics test asserts both flags off with no includeMetrics.
    • The LiteLLM and DCGM exporter capture fixtures (tests/fixtures/metrics/litellm.yaml, dcgm-exporter.yaml) drop k8s_cluster_name from their Alloy target labels; tests/test_stack_dashboards.py passes against them.
    • No test reaches the network or runs helm. Each new or changed test's call phase is 0.01 s (uv run pytest tests/test_k8s_monitoring_integration.py --durations=10).
    • changelog.d/1129.md exists; CHANGELOG.md and docs/ROADMAP.md are untouched.
    • Review render, outside the gate: helm template of the k8s-monitoring 4.5.2 chart with the previous and the new values differs in exactly four hunks: kube_hpa_labels leaves the KSM keep regex; the node_exporter keep rule is gone (the ramfs/tmpfs drop rule stays); k8s_cluster_name leaves the prometheus.remote_write "localprometheus" external labels; the alloy-singleton Alloy resource gains type: deployment and replicas: 1.
    • Pending a person, after the v0.2.32 release PR merges into main and Argo CD syncs the k8s-monitoring Application (it tracks main with selfHeal, so do not apply early with devops k8s deploy-stack from the release branch: Argo CD would revert it):
      1. kubectl get application -n argocd k8s-monitoring -o jsonpath='{.status.sync.status} {.status.sync.revisions}' prints Synced ["4.5.2","<new main sha>"].
      2. kubectl get alloys.collectors.grafana.com -n monitoring k8s-monitoring-alloy-singleton -o jsonpath='{.spec.controller.type} {.spec.controller.replicas}' prints deployment 1.
      3. kubectl get deploy,ds -n monitoring | grep alloy-singleton shows only deployment.apps/k8s-monitoring-alloy-singleton 1/1, and no DaemonSet of that name.
      4. kubectl get endpointslices -n monitoring -l kubernetes.io/service-name=k8s-monitoring-alloy-singleton -o jsonpath='{range .items[*].endpoints[*]}{.addresses[0]}{"\n"}{end}' | wc -l prints 1, so the events Ingress reaches one Alloy UI.
      5. Ten minutes later, in Grafana Explore against Prometheus: count(node_uname_info) equals the node count; count by (__name__) ({__name__=~"node_load1|node_context_switches_total|node_netstat_Tcp_CurrEstab|node_disk_io_now"}) returns all four names; count by (__name__) ({__name__=~"node_procs_blocked|node_forks_total|node_scrape_collector_success|node_systemd_units", job="integrations/node_exporter"}) returns all four names; count({k8s_cluster_name!=""}) is empty (the issue's count_over_time form errors on duplicate labelsets).
      6. Node Exporter Full shows data on every node, except the processes, interrupts and TCP connection-state panels (collectors off by default) and panels for hardware a node lacks.
  5. added a commit that references this issue on Oct 9, 2026
  6. added
    type/bug
    and removed on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/p1-highscope/k8sscope/telemetrytype/bug

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions