63 lines
2.0 KiB
YAML
63 lines
2.0 KiB
YAML
apiVersion: apps/v1
|
||
kind: DaemonSet
|
||
metadata:
|
||
name: node-exporter
|
||
namespace: monitor-sa
|
||
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: prom/node-exporter:v0.16.0
|
||
imagePullPolicy: IfNotPresent
|
||
ports:
|
||
- containerPort: 9100 # 容器暴露端口为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: # 定义容忍度,使其可调度到默认有污点的master
|
||
- 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: / |