节点导出器无法绑定端口



我的节点导出程序是使用kubernetes守护进程集安装的。节点导出器的默认端口是9100,但我本地机器上的端口已经被占用,所以我多次修改配置文件来更改端口。但每次都失败了。我尝试了以下配置:尝试次数1(将9100端口修改为19100(:

containers:
- name: prometheus-node-exporter
image: "docker.ssiid.com/prom/node-exporter:v0.18.1"
imagePullPolicy: "IfNotPresent"
args:
- --path.procfs=/host/proc
- --path.sysfs=/host/sys
ports:
- name: metrics
containerPort: 19100
hostPort: 19100
volumeMounts:
- name: proc
mountPath: /host/proc
readOnly:  true
- name: sys
mountPath: /host/sys
readOnly: true

结果是不起作用。它仍在使用日志中的9100端口

尝试次数2(向args添加新选项--web.listen address=":9100"(如下:

containers:
- name: prometheus-node-exporter
image: "docker.ssiid.com/prom/node-exporter:v0.18.1"
imagePullPolicy: "IfNotPresent"
args:
- --web.listen-address=":19100"
- --path.procfs=/host/proc
- --path.sysfs=/host/sys
ports:
- name: metrics
containerPort: 9100
hostPort: 9100
volumeMounts:
- name: proc
mountPath: /host/proc
readOnly:  true
- name: sys
mountPath: /host/sys

它仍然不起作用。错误如下:

time="2020-03-13T10:56:03Z" level=info msg=" - time" source="node_exporter.go:104"
time="2020-03-13T10:56:03Z" level=info msg=" - timex" source="node_exporter.go:104"
time="2020-03-13T10:56:03Z" level=info msg=" - uname" source="node_exporter.go:104"
time="2020-03-13T10:56:03Z" level=info msg=" - vmstat" source="node_exporter.go:104"
time="2020-03-13T10:56:03Z" level=info msg=" - xfs" source="node_exporter.go:104"
time="2020-03-13T10:56:03Z" level=info msg=" - zfs" source="node_exporter.go:104"
time="2020-03-13T10:56:03Z" level=info msg="Listening on ":19100"" source="node_exporter.go:170"
time="2020-03-13T10:56:03Z" level=fatal msg="listen tcp: address tcp/19100": unknown port" source="node_exporter.go:172"

如何更改端口?

以下配置有效:

containers:
- name: prometheus-node-exporter
image: "docker.ssiid.com/prom/node-exporter:v0.18.1"
imagePullPolicy: "IfNotPresent"
args:
- --web.listen-address=localhost:19100
- --path.procfs=/host/proc
- --path.sysfs=/host/sys
ports:
- name: metrics
containerPort: 19100