apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: pod-gpu-metrics-exporter
  namespace: monitoring
spec:
  selector:
    matchLabels:
      app: pod-gpu-metrics-exporter
  template:
    metadata:
      labels:
        app: pod-gpu-metrics-exporter
      name: pod-gpu-metrics-exporter
    spec:
      nodeSelector:
        hardware-type: NVIDIAGPU
      containers:
      - image: nvidia/pod-gpu-metrics-exporter:v1.0.0-alpha
        name: pod-nvidia-gpu-metrics-exporter
        ports:
        - name: metrics
          containerPort: 9400
          hostPort: 9400
        securityContext:
          runAsNonRoot: false
          runAsUser: 0
        volumeMounts:
        - name: pod-gpu-resources
          readOnly: true
          mountPath: /var/lib/kubelet/pod-resources
        - name: device-metrics
          readOnly: true
          mountPath: /run/prometheus
      - image: nvidia/dcgm-exporter:1.4.6
        name: nvidia-dcgm-exporter
        securityContext:
          runAsNonRoot: false
          runAsUser: 0
        volumeMounts:
        - name: device-metrics
          mountPath: /run/prometheus


      volumes:
      - name: pod-gpu-resources
        hostPath:
          path: /var/lib/kubelet/pod-resources
      - name: device-metrics
        emptyDir:
          medium: Memory
