文章目录
- 创建
node-exporter.yml
文件如下:
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: node-exporter
namespace: monitor
labels:
name: node-exporter
spec:
selector:
matchLabels:
name: node-exporter
template:
metadata:
labels:
name: node-exporter
spec:
hostPID: true
hostIPC: true
hostNetwork: true
containers:
- name: node-exporter
image: harbocto.boe.com.cn/public/node-exporter:ks-v0.16.0
ports:
- containerPort: 9100
resources:
requests:
cpu: 0.15
securityContext:
privileged: true
args:
- --path.procfs
- /host/proc
- --path.sysfs
- /host/sys
- --collector.filesystem.ignored-mount-points
- '"^/(sys|proc|dev|host|etc)($|/)"'
volumeMounts:
- name: dev
mountPath: /host/dev
- name: proc
mountPath: /host/proc
- name: sys
mountPath: /host/sys
- name: rootfs
mountPath: /rootfs
tolerations:
- key: "node-role.kubernetes.io/master"
operator: "Exists"
effect: "NoSchedule"
volumes:
- name: proc
hostPath:
path: /proc
- name: dev
hostPath:
path: /dev
- name: sys
hostPath:
path: /sys
- name: rootfs
hostPath:
path: /
kubectl create -f node-exporter.yml
[root@k8s-dev-m01 k8s_install]
NAME READY STATUS RESTARTS AGE
node-exporter-7ltzl 1/1 Running 0 14h
node-exporter-97475 1/1 Running 0 14h
node-exporter-jnmmj 1/1 Running 0 14h
node-exporter-lm49z 1/1 Running 0 14h
node-exporter-p2954 1/1 Running 0 14h
- 从页面查看结果
![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/0040a3e632ce4c22a7061af21b461a1a.png)
![](https://i-blog.csdnimg.cn/blog_migrate/92dd9b727993b3fc61db767bb2084f5d.png)