赞
踩
# cat node-exporter.yaml
apiVersion: v1
kind: Namespace
metadata:
name: kube-prom
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: node-exporter
namespace: kube-prom
labels:
k8s-app: node-exporter
spec:
selector:
matchLabels:
k8s-app: node-exporter
template:
metadata:
labels:
k8s-app: node-exporter
spec:
hostPID: true
hostIPC: true
hostNetwork: true
tolerations:
- key: node-role.kubernetes.io/master
operator: Exists
effect: NoSchedule
restartPolicy: Always
containers:
- image: registry.cn-beijing.aliyuncs.com/mayaping/node-exporter:v1.0.1
imagePullPolicy: IfNotPresent
name: node-exporter
args:
- --path.procfs
- /host/proc
- --path.sysfs
- /host/sys
- --collector.filesystem.ignored-mount-points
- '"^/(sys|proc|dev|host|etc)($|/)"'
ports:
- containerPort: 9100
protocol: TCP
name: http
securityContext:
privileged: true
volumeMounts:
- name: dev
mountPath: /host/dev
- name: proc
mountPath: /host/proc
- name: sys
mountPath: /host/sys
- name: rootfs
mountPath: /rootfs
volumes:
- name: proc
hostPath:
path: /proc
- name: dev
hostPath:
path: /dev
- name: sys
hostPath:
path: /sys
- name: rootfs
hostPath:
path: /
# kubectl apply -f node-exporter.yaml
namespace/kube-prom unchanged
daemonset.apps/node-exporter created
# kubectl get pods --namespace kube-prom
NAME READY STATUS RESTARTS AGE
node-exporter-7fh6k 1/1 Running 0 3m19s
node-exporter-dws9d 1/1 Running 0 3m19s
node-exporter-q29ll 1/1 Running 0 3m19s
prometheus-7749bcdfd8-44p9p 1/1 Running 0 134m
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。