Skip to content

fix(k8s): make node metrics listener configurable - #355

Open
jiangqiao2 wants to merge 2 commits into
ongridio:mainfrom
jiangqiao2:fix/k8s-node-metrics-port
Open

jiangqiao2 wants to merge 2 commits into
ongridio:mainfrom
jiangqiao2:fix/k8s-node-metrics-port

Conversation

@jiangqiao2

@jiangqiao2 jiangqiao2 commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Problem

The Kubernetes Node DaemonSet runs with hostNetwork: true, while the Edge diagnostics/metrics listener was hard-coded to :9101. If the target node already has a host-level ongrid-edge process or another exporter using that port, the Node Edge fails to start and enters CrashLoopBackOff.

Reproduced in production: the host-level Edge was already listening on :9101, preventing the Kubernetes Node Edge from starting.

Fixes #261

Changes

  • Added the ONGRID_EDGE_METRICS_ADDR environment variable. The default remains :9101 for backward compatibility.
  • Controller, standalone Edge, and Kubernetes data-plane diagnostics now use the same configurable address.
  • Added the Helm value node.metricsAddr and injected it into the Node DaemonSet.
  • Included the metrics address in the DaemonSet configuration checksum so changing the value triggers a rolling update.
  • Added tests covering the default value, environment variable override, and checksum changes.

Verification

  • git diff --check
  • go test ./cmd/ongrid-edge
  • Full make test-k8s-chart
  • Kubernetes verification: after setting node.metricsAddr=:19101, the Node reached 1/1 Running; :19101 and the existing :9101 listener operated simultaneously.

The local environment did not have Go or Helm installed. Unit tests and chart validation were completed on the target server with Go 1.25 and Helm.

Port Configuration

The Node DaemonSet uses hostNetwork: true and listens on :9101 by default. If another service is using that port on a node, specify an unused port:

--set-string node.metricsAddr=:19101

The value can also be set in values.yaml:

node:
  metricsAddr: ":19101"

The selected port must be available on the host of every Kubernetes node.

@jiangqiao2
jiangqiao2 requested a review from singchia as a code owner August 27, 2026 16:59
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.

Edge 指标端口 9101 与现有 node-exporter 冲突 (Edge metrics port 9101 conflict)

1 participant