PART 2: ADVANCED CONCEPTS
5. Multi-Instance GPU (MIG) Deep Dive
MIG partitions a single GPU into up to seven independent instances, each with its own:
- Stream Multiprocessors (SMs) — compute units
- GPU memory — dedicated VRAM
- Memory bandwidth — isolated
- L2 cache slices
MIG Profiles
| Profile | SMs | Memory | Use Case |
| 1g.5gb | 1/7 | 5 GB | Small inference |
| 2g.10gb | 2/7 | 10 GB | Medium inference |
| 3g.20gb | 3/7 | 20 GB | Large inference |
| 4g.20gb | 4/7 | 20 GB | Training |
| 7g.40gb | 7/7 | 40 GB | Full GPU |
Configuring MIG
MIG configuration is handled by the NVIDIA GPU Operator and MIG Manager.
yaml
# MIG configuration ConfigMap
apiVersion: v1
kind: ConfigMap
metadata:
name: mig-config
namespace: gpu-operator
data:
config.yaml: |
version: v1
mig-configs:
all-1g.5gb:
- devices: all
mig-enabled: true
mig-devices:
"1g.5gb": 7
all-2g.10gb:
- devices: all
mig-enabled: true
mig-devices:
"2g.10gb": 3
bash
# Apply MIG configuration
kubectl apply -f mig-config.yaml
# Update GPU Operator
helm upgrade gpu-operator nvidia/gpu-operator \
--namespace gpu-operator \
--set migManager.config.name=mig-config \
--reuse-values
Using MIG in Pods
yaml
apiVersion: v1
kind: Pod
metadata:
name: mig-pod
spec:
containers:
- name: app
image: nvidia/cuda:12.0-base
resources:
limits:
nvidia.com/mig-1g.5gb: 1 # Request specific MIG profile
MIG Benefits
| Benefit | Impact |
| Hardware isolation | No noisy neighbors |
| Fault isolation | One instance crash doesn't affect others |
| Memory guarantees | Dedicated VRAM per instance |
| Predictable performance | QoS guaranteed |
MIG Limitations
| Limitation | Impact |
| GPU support | Only A100, A30, H100, H200+ |
| Static profiles | Must be pre-configured |
| No dynamic reconfiguration | Requires GPU reset |
| Complexity | More operational overhead |
6. GPU Topology
For multi-GPU workloads (distributed training, large model inference), GPU topology matters. The way GPUs are connected affects communication bandwidth.
NVLink
NVLink is NVIDIA's high-speed interconnect between GPUs. It provides much higher bandwidth than PCIe.
| Connection | Bandwidth |
| PCIe Gen5 x16 | 128 GB/s |
| NVLink 3.0 (A100) | 600 GB/s |
| NVLink 4.0 (H100) | 900 GB/s |
NVSwitch
NVSwitch enables all-to-all NVLink connectivity between GPUs in a node (e.g., DGX H100 with 8 GPUs).
Topology-Aware Scheduling
The default Kubernetes scheduler is not topology-aware. Custom schedulers like KubeNexus and HAMi add topology awareness:
yaml
# HAMi topology-aware scheduling
metadata:
annotations:
hami.io/gpu-scheduler-policy: topology-aware
| Scheduler | Topology Support |
| Default K8s | ❌ None |
| KubeNexus | ✅ NVLink/NVSwitch, NUMA |
| HAMi | ✅ NVLink topology filter |
| KAI Scheduler | ✅ Gang scheduling + topology |
The Topology-Aware Filter
Topology-aware schedulers keep only cards whose NVLink/NVSwitch topology satisfies the Pod's multi-GPU request. For example, a request for 8 GPUs will only schedule on a node where all 8 GPUs are in the same NVSwitch domain.
7. Dynamic Resource Allocation (DRA) for GPUs
DRA (Dynamic Resource Allocation) is the future of GPU scheduling in Kubernetes. It replaces the integer-based extended resource model with a structured, attribute-aware API.
Why DRA
| Device Plugin | DRA |
| Integer counts only | Attribute-based requests |
| No topology awareness | Topology-aware |
| No sharing semantics | Native sharing support |
| Vendor-specific | Standard API |
DRA Concepts
| Concept | Purpose |
| DeviceClass | Describes device capabilities |
| ResourceSlice | Represents allocatable capacity |
| ResourceClaim | Declarative workload request |
| ResourceClaimTemplate | Template for claims |
NVIDIA DRA Driver
NVIDIA donated its DRA Driver for GPUs to the CNCF in 2026, transferring governance from a single vendor to full community ownership. The driver enables:
- Attribute-based scheduling aligned with device capabilities
- Integration with MIG and time-slicing mechanisms
- Better coordination between the scheduler and allocation lifecycle
DRA Example
yaml
apiVersion: resource.k8s.io/v1
kind: ResourceClaim
metadata:
name: gpu-claim
spec:
devices:
requests:
- name: gpu
deviceClassName: nvidia-gpu
selectors:
- cel:
expression: "device.attributes['memory'].value >= 40000"
DRA in Kubernetes 1.36
Kubernetes 1.36 brought several DRA features to beta/stable:
| Feature | Status | Purpose |
| Prioritized list | Stable | Fallback preferences (H100 → A100) |
| Extended resource support | Beta | Gradual migration from device plugin |
| Partitionable devices | Beta | MIG-like partitioning via DRA |
| Device taints | Beta | Taint faulty/reserved devices |
| Device binding conditions | Beta | Delay scheduling until device ready |
8. GPU Monitoring with DCGM
DCGM (Data Center GPU Manager) is NVIDIA's GPU telemetry system. The DCGM Exporter exposes GPU metrics for Prometheus.
Key GPU Metrics
| Metric | Meaning |
DCGM_FI_DEV_GPU_UTIL | GPU utilization % |
DCGM_FI_DEV_MEM_COPY_UTIL | Memory bandwidth utilization |
DCGM_FI_DEV_FB_USED | Framebuffer memory used (VRAM) |
DCGM_FI_DEV_GPU_TEMP | GPU temperature |
DCGM_FI_DEV_POWER_USAGE | Power consumption (watts) |
DCGM_FI_DEV_XID_ERRORS | GPU errors |
Deploying DCGM Exporter
DCGM Exporter is deployed as part of the GPU Operator:
bash
# Verify DCGM Exporter
kubectl get pods -n gpu-operator -l app=nvidia-dcgm-exporter
# Port-forward to test
kubectl port-forward -n gpu-operator svc/nvidia-dcgm-exporter 9400:9400
curl localhost:9400/metrics | grep DCGM_FI_DEV_GPU_UTIL
GPU Alerts
| Alert | Condition | Action |
| GPU Idle | DCGM_FI_DEV_GPU_UTIL < 5% for 30 min | Kill idle workload |
| GPU Memory Pressure | DCGM_FI_DEV_FB_USED > 90% | Increase GPU memory or MIG slice |
| GPU Temperature | DCGM_FI_DEV_GPU_TEMP > 85°C | Check cooling, throttle |
| GPU Errors | DCGM_FI_DEV_XID_ERRORS > 0 | Investigate hardware |
GPU Utilization Dashboard
Grafana dashboards for GPU monitoring show:
- GPU utilization per node/pod
- VRAM usage
- Temperature and power
- XID errors
- MIG instance utilization
9. GPU Multi-Tenancy Strategies
The Four Layers of GPU Isolation
| Layer | Mechanism | Isolation Level |
| Kubernetes | Namespaces, RBAC, ResourceQuota | Logical |
| Scheduling | PriorityClasses, node affinity | Placement |
| Hardware | MIG, time-slicing | Physical/Logical |
| Runtime | Kata Containers (microVM) | Hardware VM |
Layer 1: Kubernetes Namespaces and Quotas
yaml
apiVersion: v1
kind: ResourceQuota
metadata:
name: gpu-quota
namespace: team-a
spec:
hard:
requests.nvidia.com/gpu: "4"
limits.nvidia.com/gpu: "4"
Layer 2: MIG for Hardware Isolation
For production multi-tenant GPU clusters, MIG is essential:
| Tenant | MIG Profile | Guaranteed Resources |
| Team A | 2g.10gb | 2/7 SMs, 10 GB VRAM |
| Team B | 2g.10gb | 2/7 SMs, 10 GB VRAM |
| Team C | 3g.20gb | 3/7 SMs, 20 GB VRAM |
Layer 3: Kata Containers for Strongest Isolation
Kata Containers run each pod inside a lightweight virtual machine. GPUs are exposed via VFIO passthrough, and isolation is enforced at the hardware virtualization boundary.
NVIDIA collaborated with the CNCF Confidential Containers community to introduce GPU support for Kata Containers in 2026.
Layer 4: KAI Scheduler for Fair Sharing
KAI Scheduler (CNCF Sandbox) provides:
- Gang scheduling for coordinated multi-pod execution
- Hierarchical queues with Dominant Resource Fairness (DRF)
- Fair sharing of GPUs across teams
Multi-Tenancy Decision Matrix
| Tenant Type | Isolation Strategy |
| Internal teams | Namespaces + quotas + MIG |
| External customers | vCluster + MIG + Kata |
| Regulated workloads | Kata + MIG + dedicated nodes |
| Hostile tenants | Separate clusters |
10. KAI Scheduler
KAI Scheduler was accepted as a CNCF Sandbox project in 2026, marking its transition from an NVIDIA-governed tool to a community-developed standard.
KAI Scheduler Capabilities
| Capability | Purpose |
| Gang scheduling | All-or-nothing placement for distributed jobs |
| Hierarchical queues | Team quotas with DRF |
| Sub-GPU allocation | Fractional GPU support |
| Pre-scheduling simulation | Reduce preemption overhead |
| Fair sharing | Prevent team starvation |
When to Use KAI Scheduler
| Use Case | KAI Scheduler? |
| Distributed training | ✅ Yes |
| Multi-team GPU sharing | ✅ Yes |
| Simple inference | ❌ Default scheduler |
| Single-team cluster | ❌ Default scheduler |
11. Kueue and Volcano
Kueue
Kueue is a Kubernetes-native job queueing system. It admits jobs based on quotas and priorities.
yaml
apiVersion: kueue.x-k8s.io/v1beta1
kind: ClusterQueue
metadata:
name: gpu-queue
spec:
namespaceSelector: {}
resourceGroups:
- coveredResources: ["nvidia.com/gpu"]
flavors:
- name: default
resources:
- name: nvidia.com/gpu
nominalQuota: 8
Volcano
Volcano is a CNCF incubating project for batch and AI/ML scheduling. It supports:
- Gang scheduling
- Fair-share scheduling
- Queue-based scheduling
- Topology-aware scheduling
Kueue vs Volcano
| Aspect | Kueue | Volcano |
| Focus | Job queueing | Full batch scheduler |
| Gang scheduling | ✅ | ✅ |
| Fair sharing | ✅ | ✅ |
| Topology awareness | Limited | ✅ |
| CNCF Status | Incubating | Incubating |
12. GPU Cost Optimization
The Five Strategies
| Strategy | Savings | Best For |
| Spot instances | 70–91% | Fault-tolerant training |
| Right-sizing GPU | 30–50% | All workloads |
| MIG/time-slicing | 50–70% | Inference |
| Autoscaling | Variable | Inference |
| Reserved instances | 30–60% | Predictable baseline |
Training vs Inference Cost Profiles
| Aspect | Training | Inference |
| Pattern | Batch, predictable | Continuous, variable |
| Duration | Hours to days | 24/7 |
| Optimization | Spot + checkpointing | Autoscaling + sharing |
| Commitment | Reserved instances | Baseline commitments |
Spot Instances for Training
Spot instances work well for fault-tolerant training (checkpointing every N minutes), delivering 70–91% cost reductions compared to on-demand pricing.
yaml
# Spot node pool toleration
spec:
tolerations:
- key: "spot-instance"
operator: "Equal"
value: "true"
effect: "NoSchedule"
GPU Memory Right-Sizing
| Model Size | Recommended GPU | VRAM |
| 7B params | A100 40GB | 16 GB (FP16) |
| 13B params | A100 40GB | 26 GB (FP16) |
| 70B params | A100 80GB / H100 | 140 GB (FP16) |
| Fine-tuning 7B | A100 40GB | 20 GB |
Cost Per Token Optimization
For inference, the optimization goal is cost per token:
| Strategy | Impact |
| Mix GPU generations | H100 for prefill, A100 for decode |
| MIG for small models | Share GPU across models |
| Autoscale on traffic | Scale to zero when idle |
| KV-cache optimization | Reduce VRAM per request |
13. Kata Containers for GPU Isolation
Kata Containers run each pod inside a lightweight virtual machine, providing hardware-level isolation.
How Kata Works with GPUs
text
┌─────────────────────────────────────────────────────────────┐
│ KATA CONTAINERS + GPU │
│ │
│ Pod → Kata VM (microVM) → VFIO Passthrough → GPU │
│ │
│ • Each pod gets its own microVM │
│ • GPU is passed through via VFIO │
│ • Isolation at hardware virtualization boundary │
│ • Stronger than standard containers │
└─────────────────────────────────────────────────────────────┘
When to Use Kata
| Scenario | Kata? |
| Regulated multi-tenant | ✅ Yes |
| Untrusted workloads | ✅ Yes |
| Internal trusted teams | ❌ Standard containers |
| Performance-critical | ⚠️ Evaluate overhead |
1:1 copy of the class Google Doc, code in code blocks.