GPUs
Kubernetes has access to several virtual GPUs. Currently, the only GPU model we can offer is the NVIDIA A40 12Q.
GPUs are provided on a short-term basis only. We cannot predict how the GPU situation will develop or how long GPUs will remain in operation on our platform. We therefore reserve the right to remove GPUs from Kubernetes at any time. Please do not build services that depend on long-term GPU availability.
Currently, all GPUs are being utilized for JupyterHub, and all previous use cases have been well accommodated there.
If, however, there is a compelling reason why your service requires access to a GPU, please feel free to send a request with an explanation to cloud@uni-muenster.de, and we will evaluate the case together with you.
As a best practice, GPUs should not be held by long-running processes. Allocate them within jobs instead, even in the case of a service, so that the resources are freed as soon as the computations are completed.
Furthermore, it may take several minutes until the job is started with a GPU, as a separate virtual machine must be launched for each GPU pod. It is also possible that all GPUs are being used elsewhere, such as in JupyterHub, so one may need to wait until a GPU becomes available again.
Using a GPU in a pod
To run a pod on a GPU node, three things have to be set in the pod spec:
- a node selector that picks the GPU model,
- a resource request and limit for
nvidia.com/gpu, - tolerations for the taints on the GPU nodes.
apiVersion: v1
kind: Pod
metadata:
name: gpu-example
spec:
nodeSelector:
nvidia.com/gpu.product: NVIDIA-A40-12Q
tolerations:
- key: role.node.kubernetes.io/worker-vgpu
operator: Exists
effect: NoSchedule
- key: nvidia.com/gpu.product
operator: Equal
value: NVIDIA-A40-12Q
effect: NoSchedule
containers:
- name: gpu-example
image: <your-image>
resources:
requests:
nvidia.com/gpu: "1"
limits:
nvidia.com/gpu: "1"
Node selector
nvidia.com/gpu.product: NVIDIA-A40-12Q schedules the pod onto a node with the A40 12Q GPU. Currently, this is the only GPU model available.
Resources
The GPU is requested via the extended resource nvidia.com/gpu. Extended resources cannot be overcommitted, so the request and the limit must be identical. Currently, only one GPU per pod is possible, so the value must be "1". More GPUs per pod are not offered. See also the Security Policies.
Tolerations
GPU nodes are tainted so that regular workloads are not scheduled onto them. The pod therefore has to tolerate the taints role.node.kubernetes.io/worker-vgpu and nvidia.com/gpu.product=NVIDIA-A40-12Q, both with the effect NoSchedule.
The example only shows the GPU-specific fields. All other Security Policies apply to GPU pods as usual. As described above, prefer running GPU workloads as jobs: the same fields go into the pod template (.spec.template.spec) of a Job.