From 86403d3907f8fdd172829fc656b22ce43c488ac8 Mon Sep 17 00:00:00 2001 From: leonnicolas Date: Thu, 4 Feb 2021 10:17:24 +0100 Subject: [PATCH] k8s: add spec --- http-wrapper/k8s/deployment.yaml | 39 ++++++++++++++++++++ http-wrapper/k8s/device-plugin.yaml | 57 +++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 http-wrapper/k8s/deployment.yaml create mode 100644 http-wrapper/k8s/device-plugin.yaml diff --git a/http-wrapper/k8s/deployment.yaml b/http-wrapper/k8s/deployment.yaml new file mode 100644 index 0000000..50b6333 --- /dev/null +++ b/http-wrapper/k8s/deployment.yaml @@ -0,0 +1,39 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: rust-opencl-demo + namespace: default +spec: + replicas: 1 + selector: + matchLabels: + app: rust-opencl-demo + template: + metadata: + labels: + app: rust-opencl-demo + spec: + containers: + - name: rust-opencl-demo + image: leonnicolas/rust-opencl-demo-wrapper + args: + - --command=rust-opencl-demo + - --args=calculate-primes,--end,1000,--local-size,256,--numbers-per-step,12288,--stdout + env: + - name: LD_LIBRARY_PATH + value: /usr/lib/x86_64-linux-gnu:/usr/local/nvidia + livenessProbe: + httpGet: + path: /status + port: 8080 + initialDelaySeconds: 30 + periodSeconds: 5 + ports: + - containerPort: 8080 + resources: + limits: + nvidia.com/gpu: 1 + tolerations: + - key: nvidia.com/gpu + effect: NoSchedule + operator: Exists diff --git a/http-wrapper/k8s/device-plugin.yaml b/http-wrapper/k8s/device-plugin.yaml new file mode 100644 index 0000000..f991752 --- /dev/null +++ b/http-wrapper/k8s/device-plugin.yaml @@ -0,0 +1,57 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: nvidia-gpu-device-plugin + namespace: kube-system + labels: + k8s-app: nvidia-gpu-device-plugin + addonmanager.kubernetes.io/mode: EnsureExists +spec: + selector: + matchLabels: + k8s-app: nvidia-gpu-device-plugin + template: + metadata: + labels: + k8s-app: nvidia-gpu-device-plugin + spec: + priorityClassName: system-node-critical + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: hwr-berlin.de/nvidia-accelerator + operator: Exists + tolerations: + - operator: "Exists" + effect: "NoExecute" + - operator: "Exists" + effect: "NoSchedule" + volumes: + - name: device-plugin + hostPath: + path: /var/lib/kubelet/device-plugins + - name: dev + hostPath: + path: /dev + containers: + - image: "gcr.io/gke-release/nvidia-gpu-device-plugin@sha256:a75ec0caa9e3038bd9886b3f36641a624574ff34b064974de6ee45048de3372b" + command: ["/usr/bin/nvidia-gpu-device-plugin", "-logtostderr","--host-path=/usr/lib/x86_64-linux-gnu"] + name: nvidia-gpu-device-plugin + resources: + requests: + cpu: 50m + memory: 10Mi + limits: + cpu: 50m + memory: 10Mi + securityContext: + privileged: true + volumeMounts: + - name: device-plugin + mountPath: /device-plugin + - name: dev + mountPath: /dev + updateStrategy: + type: RollingUpdate