apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: nvidia-gpu-monitoring-daemonset
  namespace: monitoring
  labels:
    k8s-app: nvidia-gpu-monitoring-daemonset
spec:
  selector:
    matchLabels:
      k8s-app: nvidia-gpu-monitoring-daemonset
  template:
    metadata:
      labels:
        k8s-app: nvidia-gpu-monitoring-daemonset
      annotations:
        prometheus.io/extension: 'true'
        prometheus.io/port: '8080'
    spec:
      containers:
      - image: "gcr.io/dashpole-gke-dev/gpu-monitor:v0"
        name: gpu-monitor
        args: ["--socket=unix:///podresources/pod-resources/kubelet.sock", "--v=10"]
        volumeMounts:
        - name: kubelet-podresources
          mountPath: /podresources
          readOnly: true
        - name: dev
          mountPath: /dev
          readOnly: true
        - name: libnvidia
          mountPath: /home/kubernetes/bin/nvidia/lib64/
          readOnly: true
        securityContext:
          privileged: true
        ports:
          - name: http
            containerPort: 8080
            protocol: TCP
        env:
        - name: LD_LIBRARY_PATH
          value: "/home/kubernetes/bin/nvidia/lib64/"
      nodeSelector:
        cloud.google.com/gke-accelerator: nvidia-tesla-k80
      tolerations:
      - key: "nvidia.com/gpu"
        value: "present"
        effect: "NoSchedule"
      volumes:
        - name: kubelet-podresources
          hostPath:
            path: /var/lib/kubelet/
        - name: dev
          hostPath:
            path: /dev
        - name: libnvidia
          hostPath:
            path: /home/kubernetes/bin/nvidia/lib64/
