Skip to main content
AI on Kubernetes · GPU/NPULesson 4 of 20

Sharing GPUs

GPUs are expensive, so keep them busy by sharing them. On Kubernetes, the NVIDIA GPU Operator lets you use one GPU whole (dedicated), split by hardware partitions (MIG), or split in time (Time-Slicing). Follow what each mode divides and what shows up in the metrics.

ModeDedicated
Jobs per GPU1
Isolation between jobsFully isolated
Per-pod usageVisible
Workload cluster · GPU nodeUserAdmin · developerAPI serverConfig · queriesGPU dashboardPrometheus·GrafanaGPU OperatorDevice pluginGPU cardOne cardJob APodJob BPodJob CPodWhole GPU
RequestResponse / reportWatchAppears in a later step

What you will learn

  • Dedicated is the default: one job uses a whole GPU
  • The GPU Operator is what actually hands out GPUs
  • How MIG and Time-Slicing differ in isolation
  • Why the dashboard metrics change with the sharing mode

Try it yourself​

kubectl get pods -n gpu-operator # GPU Operator component status
kubectl describe node <gpu-node> | grep -i nvidia # GPU resource name and count, MIG labels
kubectl get pods -A -o wide | grep -i gpu # Which node each GPU pod runs on

Check yourself

  1. Two jobs must not affect each other's memory, but you want to share one A100. Which mode fits?
  2. After turning on Time-Slicing, the dashboard shows only whole-GPU values and no per-pod GPU usage. What is going on?
  3. You edited the Time-Slicing ConfigMap, but the node's allocatable GPU count did not change. What did you likely miss?

Further reading: Scheduling GPUs · Device plugins · NVIDIA GPU Operator · GPU Operator with MIG · Time-Slicing GPUs · Requesting GPUs by Criteria (DRA)