kind: DaemonSet
apiVersion: apps/v1
metadata:
  name: nvidiaheartbeat
  namespace: default
spec:
  selector:
    matchLabels:
      name: nvidiaheartbeat
  template:
    metadata:
      name: nvidiaheartbeat
      labels:
        nvidiaheartbeat-node: pod
    spec:
      dnsPolicy: ClusterFirstWithHostNet 
      containers:
      - name: nvidiaheartbeat
        image: nvidia/cuda:8.0
        command: ["bash","-c","bash -c 'while true; do nvidia-smi | grep Tesla | wc -l; sleep 10; done'"]
        securityContext:
          privileged: true
        volumeMounts:
        - mountPath: /usr/local/nvidia
          name: nvidia-driver
        - mountPath: /dev
          name: dev
      volumes:
      # temporarily hard-coding the path to nvidia driver; after nvidia-docker is enabled on kubernetes, this will be removed. 
      - name: nvidia-driver
        hostPath:
          path: /opt/nvidia-driver/current          
      - name: dev
        hostPath:
          path: /dev              