prometheus node exporter: Configure exposing IP (#21490)

Right now node exporter exposes the user defined port on all the
interfaces using `0.0.0.0`.

This commit changes the behavior by adding a boolean
`service.listenOnAllInterfaces` which lets user decide if it should
expose the node exporter pod on all interfaces or only on the IP which
pod is assigned.

Signed-off-by: Suraj Deshmukh <surajd.service@gmail.com>
This commit is contained in:
Suraj Deshmukh
2020-03-19 06:45:23 -07:00
committed by GitHub
parent 6abcbe46b8
commit 55f6ee71e2
4 changed files with 14 additions and 2 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ apiVersion: v1
appVersion: 0.18.1
description: A Helm chart for prometheus node-exporter
name: prometheus-node-exporter
version: 1.9.0
version: 1.9.1
home: https://github.com/prometheus/node_exporter/
sources:
- https://github.com/prometheus/node_exporter/
@@ -52,6 +52,7 @@ The following table lists the configurable parameters of the Node Exporter chart
| `service.port` | The service port | `9100` |
| `service.targetPort` | The target port of the container | `9100` |
| `service.nodePort` | The node port of the service | |
| `service.listenOnAllInterfaces` | If true, listen on all interfaces using IP `0.0.0.0`. Else listen on the IP address pod has been assigned by Kubernetes. | `true` |
| `service.annotations` | Kubernetes service annotations | `{prometheus.io/scrape: "true"}` |
| `serviceAccount.create` | Specifies whether a service account should be created. | `true` |
| `serviceAccount.name` | Service account to be used. If not set and `serviceAccount.create` is `true`, a name is generated using the fullname template | |
@@ -38,10 +38,20 @@ spec:
args:
- --path.procfs=/host/proc
- --path.sysfs=/host/sys
- --web.listen-address=0.0.0.0:{{ .Values.service.port }}
- --web.listen-address=$(HOST_IP):{{ .Values.service.port }}
{{- if .Values.extraArgs }}
{{ toYaml .Values.extraArgs | indent 12 }}
{{- end }}
env:
- name: HOST_IP
{{- if .Values.service.listenOnAllInterfaces }}
value: 0.0.0.0
{{- else }}
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: status.hostIP
{{- end }}
ports:
- name: metrics
containerPort: {{ .Values.service.targetPort }}
@@ -11,6 +11,7 @@ service:
port: 9100
targetPort: 9100
nodePort:
listenOnAllInterfaces: true
annotations:
prometheus.io/scrape: "true"