apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: gpu-metrics-exporter
  labels:
    app.kubernetes.io/name: gpu-metrics-exporter
    app.kubernetes.io/version: "1.0.0-alpha.0"
spec:
  selector:
    matchLabels:
      #istio标签
      app: gpu-metrics-exporter
  template:
    metadata:
      labels:
        app: gpu-metrics-exporter
        app.kubernetes.io/name: pod-gpu-metrics-exporter
        app.kubernetes.io/part-of: gpu-metrics-exporter
        app.kubernetes.io/version: "1.0.0-alpha.0"
      name: pod-gpu-metrics-exporter
    spec:
      containers:
      - image: nvidia/pod-gpu-metrics-exporter:v1.0.0-alpha
        name: pod-nvidia-gpu-metrics-exporter
        ports:
        - name: gpu-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
