Kubernetes kubeadm cluster monitoring article—node-exporter deployment

Write node-exporter yaml file

# 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: /

Deploy node-exporter

# kubectl apply -f node-exporter.yaml 
namespace/kube-prom unchanged
daemonset.apps/node-exporter created

Check pod container status

# 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

Guess you like

Origin blog.csdn.net/cljdsc/article/details/134694623