Last active
February 24, 2020 21:59
-
-
Save Halliax/1f6e24009432d889545aa87b74420bb8 to your computer and use it in GitHub Desktop.
Simple working example of a k8s Deployment configured to run on the GPU nodes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: apps/v1 | |
| kind: Deployment | |
| metadata: | |
| name: cuda-vector-add | |
| labels: | |
| app: cuda-vector-add | |
| spec: | |
| replicas: 3 | |
| selector: | |
| matchLabels: | |
| app: cuda-vector-add | |
| template: | |
| metadata: | |
| labels: | |
| app: cuda-vector-add | |
| spec: | |
| # requires pods to be run on an nvidia.com/gpu labeled node | |
| nodeSelector: | |
| nvidia.com/gpu: "true" | |
| # allows pods to be run on an nvidia.com/gpu tainted node | |
| tolerations: | |
| - key: "nvidia.com/gpu" | |
| operator: "Exists" | |
| effect: "NoSchedule" | |
| containers: | |
| - name: cuda-vector-add | |
| # https://github.com/kubernetes/kubernetes/blob/v1.7.11/test/images/nvidia-cuda/Dockerfile | |
| image: "k8s.gcr.io/cuda-vector-add:v0.1" | |
| resources: | |
| # don't use requests for GPUs: https://kubernetes.io/docs/tasks/manage-gpus/scheduling-gpus/ | |
| limits: | |
| nvidia.com/gpu: 1 # requesting 1 GPU |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment