Skip to content

[prometheus-node-exporter] make kube-rbac-proxy listen host configurable#6716

Open
firasmosbehi wants to merge 1 commit into
prometheus-community:mainfrom
firasmosbehi:codex/6250-node-exporter-rbac-proxy-listen-host
Open

[prometheus-node-exporter] make kube-rbac-proxy listen host configurable#6716
firasmosbehi wants to merge 1 commit into
prometheus-community:mainfrom
firasmosbehi:codex/6250-node-exporter-rbac-proxy-listen-host

Conversation

@firasmosbehi

Copy link
Copy Markdown
Contributor

Summary

This PR makes kube-rbac-proxy listen host configurable in prometheus-node-exporter and addresses #6250.

Problem

When kubeRBACProxy.enabled=true, the chart hardcodes --secure-listen-address=:<port>, which binds on all interfaces. Users with multi-NIC nodes cannot constrain exposure to a specific interface/IP without post-render patching.

Root cause

The daemonset template hardcodes --secure-listen-address host prefix and does not expose a corresponding value.

Fix

  • Added kubeRBACProxy.listenHost in values with default ":" to preserve existing behavior.
  • Updated kube-rbac-proxy args to use --secure-listen-address={{ .Values.kubeRBACProxy.listenHost }}{{ .Values.service.port }}.
  • Bumped chart version from 4.52.0 to 4.52.1.

Validation

  • helm lint charts/prometheus-node-exporter
  • helm template test charts/prometheus-node-exporter --set kubeRBACProxy.enabled=true --set service.port=9100 --set-string 'kubeRBACProxy.listenHost=$(POD_IP):'
  • Verified rendered arg contains --secure-listen-address=$(POD_IP):9100.

Compatibility

Default behavior remains unchanged because listenHost defaults to ":" (all interfaces).

Signed-off-by: Firas Mosbehi <firas.mosbehi@insat.ucar.tn>
@firasmosbehi firasmosbehi changed the title [codex] [prometheus-node-exporter] make kube-rbac-proxy listen host configurable [prometheus-node-exporter] make kube-rbac-proxy listen host configurable Mar 6, 2026
@firasmosbehi firasmosbehi changed the title [prometheus-node-exporter] make kube-rbac-proxy listen host configurable [codex] [prometheus-node-exporter] make kube-rbac-proxy listen host configurable Mar 6, 2026
@firasmosbehi firasmosbehi marked this pull request as ready for review March 6, 2026 09:44
@firasmosbehi firasmosbehi changed the title [codex] [prometheus-node-exporter] make kube-rbac-proxy listen host configurable [prometheus-node-exporter] make kube-rbac-proxy listen host configurable Mar 6, 2026
port: 8100
# Host prefix for kube-rbac-proxy secure listen address.
# Keep ":" to listen on all interfaces, or set values like "127.0.0.1:" or "$(POD_IP):".
listenHost: ":"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If not set, the field's value is an empty string:

Suggested change
listenHost: ":"
listenHost: ""

{{- .Values.kubeRBACProxy.extraArgs | toYaml | nindent 12 }}
{{- end }}
- --secure-listen-address=:{{ .Values.service.port}}
- --secure-listen-address={{ .Values.kubeRBACProxy.listenHost }}{{ .Values.service.port}}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- --secure-listen-address={{ .Values.kubeRBACProxy.listenHost }}{{ .Values.service.port}}
- --secure-listen-address={{ printf "%s:%d" .Values.kubeRBACProxy.listenHost (.Values.service.port | int) }}

# Specify the port used for the Node exporter container (upstream port)
port: 8100
# Host prefix for kube-rbac-proxy secure listen address.
# Keep ":" to listen on all interfaces, or set values like "127.0.0.1:" or "$(POD_IP):".

@zeritti zeritti Mar 13, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Keep ":" to listen on all interfaces, or set values like "127.0.0.1:" or "$(POD_IP):".
# Keep default to listen on all interfaces, or set a custom value like "$(POD_IP)".

The only reasonable setting for the IP to listen on is the pod's IP (POD_IP). Setting an environment variable in the container from a fieldRef is currently not supported by the chart, though.

- exporter
type: application
version: 4.52.0
version: 4.52.1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
version: 4.52.1
version: 4.53.0

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.

2 participants