apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: kube-gpu
  namespace: kube-system
spec:
  selector:
    matchLabels:
      doslab: kube-gpu
  template:
    metadata:
      labels:
        doslab: kube-gpu
    spec:
      terminationGracePeriodSeconds: 0
      restartPolicy: Always
      hostPID: true
      containers:
      - name: cuda-init
        image: registry.cn-beijing.aliyuncs.com/doslab/vcuda-lib:v1.0.3
        command: [ "/bin/sh","-c" ]
        args: [ "cp -r /tmp/nvidia /tmp/box && sleep infinity" ]
        volumeMounts:
        - name: lib
          mountPath: /tmp/box/nvidia
      - name: kube-gpu
        image: registry.cn-beijing.aliyuncs.com/doslab/kube-gpu:v0.2.0-amd64
        env:
        - name: DAEMON_NODE_NAME
          valueFrom:
            fieldRef:
              fieldPath: spec.nodeName
        command: ["kube-gpu"]
        args: ["--masterUrl=https://133.133.135.42:6443", "--token=eyJhbGciOiJSUzI1NiIsImtpZCI6InZCSVQ0NWZVMXNlZVVGSjNZRnJSb2JsSlZWSHd5ckxLOHBoNEVucV9ERFUifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJrdWJlcm5ldGVzLWNsaWVudC10b2tlbi1jZm05YiIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50Lm5hbWUiOiJrdWJlcm5ldGVzLWNsaWVudCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50LnVpZCI6IjhhMGZiZThhLWY1MWUtNDdkNy1hZjQ4LTIyY2E0N2QwNzY4YSIsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDprdWJlLXN5c3RlbTprdWJlcm5ldGVzLWNsaWVudCJ9.C2yuooWwlRz5XBImx8UpShWHXkVdz7IWO6-KWvODZtyE8kvDu0CyW2l2lD2SKCi0fm5zltZWqrJ2bK4cnhbKZ7-2Bd3NqUXNaumUeNzH1Zi9h7i9UExeuCC3ejWA1YtogLhVtxKJVnhX7lRkC-jWQKWGi24r-i7eqnOhjprN1TzjtF5X-N3Ub-4fE6AmsSgTuQcoEF3G4I8CWR40Y_o5EbAHKPd0PJRodaiBWna8qAo5NYuuBkwzfmvem6TEeCdpovt1wtj5z8wt6p4kHOPTAeHoZJLgfBgwKtbKfBDE8PZs0vYvOEgxajKfn1SFFsiikS7RT2qz5UUbgBS6CXwgow"]
        securityContext:
          privileged: true
        volumeMounts:
        - name: device-plugin
          mountPath: /var/lib/kubelet/device-plugins
        - name: vcuda
          mountPath: /etc/kube-gpu/vm
        - name: cgroup
          mountPath: /sys/fs/cgroup
          readOnly: true
      volumes:
      - name: device-plugin
        hostPath:
          path: /var/lib/kubelet/device-plugins
      - name: vcuda
        hostPath:
          path: /etc/kube-gpu/vm
      - name: lib
        hostPath:
          path: /etc/kube-gpu/vdriver/nvidia
      - name: cgroup
        hostPath:
          path: /sys/fs/cgroup