我的节点导出器是使用 kubernetes daemonset 安装的。node exporter的默认端口是9100,但是我的本地机器上的端口已经被占用了,所以我多次修改config文件来更改端口。但每次都失败了。以下配置是我尝试过的:tryied times 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"
如何更改端口?