---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  labels:
    app.kubernetes.io/name: pod-netstat-exporter
  name: pod-netstat-exporter
  namespace: monitoring
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: pod-netstat-exporter
  template:
    metadata:
      labels:
        app.kubernetes.io/name: pod-netstat-exporter
    spec:
      serviceAccountName: pod-netstat-exporter
      tolerations:
      - key: 'node-role.kubernetes.io/master'
        effect: 'NoSchedule'
      - key: 'CriticalAddonsOnly'
        operator: 'Exists'
      containers:
      - name: pod-netstat-exporter
        image: ghcr.io/jubel-han/pod-netstat-exporter:master
        imagePullPolicy: IfNotPresent
        env:
        - name: LOG_LEVEL
          value: INFO
        - name: KUBELET_API_INSECURE_SKIP_VERIFY
          value: "TRUE"
        - name: NODE_NAME
          valueFrom:
            fieldRef:
              fieldPath: spec.nodeName
        ports:
        - name: metrics
          containerPort: 8080
          protocol: 'TCP'
        livenessProbe:
          httpGet:
            path: /healthz
            port: 8080
        readinessProbe:
          httpGet:
            path: /healthz
            port: 8080
        volumeMounts: 
        - name: 'hproc'
          mountPath: '/host/proc'
        - name: 'hsys'
          mountPath: '/host/sys'
        - name: 'hvr'
          mountPath: '/host/var/run'
      volumes:
      - name: 'hproc'
        hostPath: 
          path: '/proc'
      - name: 'hsys'
        hostPath: 
          path: '/sys'
      - name: 'hvr'
        hostPath: 
          path: '/var/run'
