From a7b2864a7b6acedbe8482ffa51586704f1c78d58 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Wed, 21 Nov 2018 09:59:06 -0800 Subject: [PATCH] add example kustomization which gives cAdvisor access to NVML --- .../overlays/examples/gpu-privilages.yaml | 29 +++++++++++++++++++ .../overlays/examples/kustomization.yaml | 1 + 2 files changed, 30 insertions(+) create mode 100644 deploy/kubernetes/overlays/examples/gpu-privilages.yaml diff --git a/deploy/kubernetes/overlays/examples/gpu-privilages.yaml b/deploy/kubernetes/overlays/examples/gpu-privilages.yaml new file mode 100644 index 00000000..b2f21559 --- /dev/null +++ b/deploy/kubernetes/overlays/examples/gpu-privilages.yaml @@ -0,0 +1,29 @@ +# This patch adds the required hostpath mounts and privilages to initialize NVML, as well as to access devices. +# This patch meets the requirements described in the accellerator docs: +# https://github.com/google/cadvisor/blob/master/docs/running.md#hardware-accelerator-monitoring +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: cadvisor +spec: + template: + spec: + containers: + - name: cadvisor + volumeMounts: + - name: dev + mountPath: /dev + - name: libnvidia + mountPath: /bin/nvidia/lib64/ + securityContext: + privileged: true # TODO use more granular permissions (e.g. linux capabilities) to allow cAdvisor to use NVML + env: + - name: LD_LIBRARY_PATH + value: "/bin/nvidia/lib64/" + volumes: + - name: dev + hostPath: + path: /dev + - name: libnvidia + hostPath: + path: /home/kubernetes/bin/nvidia/lib64/ # Insert your path to libnvidia here \ No newline at end of file diff --git a/deploy/kubernetes/overlays/examples/kustomization.yaml b/deploy/kubernetes/overlays/examples/kustomization.yaml index 7935e558..965fde6a 100644 --- a/deploy/kubernetes/overlays/examples/kustomization.yaml +++ b/deploy/kubernetes/overlays/examples/kustomization.yaml @@ -4,3 +4,4 @@ patches: - stackdriver-sidecar.yaml - critical-priority.yaml - cadvisor-args.yaml +- gpu-privilages.yaml