Stage 12, Part 2 of 9, GPU Orchestration & Multi-Tenancy

Text

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:

MIG Profiles

ProfileSMsMemoryUse Case
1g.5gb1/75 GBSmall inference
2g.10gb2/710 GBMedium inference
3g.20gb3/720 GBLarge inference
4g.20gb4/720 GBTraining
7g.40gb7/740 GBFull 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

BenefitImpact
Hardware isolationNo noisy neighbors
Fault isolationOne instance crash doesn't affect others
Memory guaranteesDedicated VRAM per instance
Predictable performanceQoS guaranteed

MIG Limitations

LimitationImpact
GPU supportOnly A100, A30, H100, H200+
Static profilesMust be pre-configured
No dynamic reconfigurationRequires GPU reset
ComplexityMore 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.

ConnectionBandwidth
PCIe Gen5 x16128 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
SchedulerTopology 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 PluginDRA
Integer counts onlyAttribute-based requests
No topology awarenessTopology-aware
No sharing semanticsNative sharing support
Vendor-specificStandard API

DRA Concepts

ConceptPurpose
DeviceClassDescribes device capabilities
ResourceSliceRepresents allocatable capacity
ResourceClaimDeclarative workload request
ResourceClaimTemplateTemplate 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:

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:

FeatureStatusPurpose
Prioritized listStableFallback preferences (H100 → A100)
Extended resource supportBetaGradual migration from device plugin
Partitionable devicesBetaMIG-like partitioning via DRA
Device taintsBetaTaint faulty/reserved devices
Device binding conditionsBetaDelay 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

MetricMeaning
DCGM_FI_DEV_GPU_UTILGPU utilization %
DCGM_FI_DEV_MEM_COPY_UTILMemory bandwidth utilization
DCGM_FI_DEV_FB_USEDFramebuffer memory used (VRAM)
DCGM_FI_DEV_GPU_TEMPGPU temperature
DCGM_FI_DEV_POWER_USAGEPower consumption (watts)
DCGM_FI_DEV_XID_ERRORSGPU 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

AlertConditionAction
GPU IdleDCGM_FI_DEV_GPU_UTIL < 5% for 30 minKill idle workload
GPU Memory PressureDCGM_FI_DEV_FB_USED > 90%Increase GPU memory or MIG slice
GPU TemperatureDCGM_FI_DEV_GPU_TEMP > 85°CCheck cooling, throttle
GPU ErrorsDCGM_FI_DEV_XID_ERRORS > 0Investigate hardware

GPU Utilization Dashboard

Grafana dashboards for GPU monitoring show:


9. GPU Multi-Tenancy Strategies

The Four Layers of GPU Isolation

LayerMechanismIsolation Level
KubernetesNamespaces, RBAC, ResourceQuotaLogical
SchedulingPriorityClasses, node affinityPlacement
HardwareMIG, time-slicingPhysical/Logical
RuntimeKata 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:

TenantMIG ProfileGuaranteed Resources
Team A2g.10gb2/7 SMs, 10 GB VRAM
Team B2g.10gb2/7 SMs, 10 GB VRAM
Team C3g.20gb3/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:

Multi-Tenancy Decision Matrix

Tenant TypeIsolation Strategy
Internal teamsNamespaces + quotas + MIG
External customersvCluster + MIG + Kata
Regulated workloadsKata + MIG + dedicated nodes
Hostile tenantsSeparate 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

CapabilityPurpose
Gang schedulingAll-or-nothing placement for distributed jobs
Hierarchical queuesTeam quotas with DRF
Sub-GPU allocationFractional GPU support
Pre-scheduling simulationReduce preemption overhead
Fair sharingPrevent team starvation

When to Use KAI Scheduler

Use CaseKAI 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:

Kueue vs Volcano

AspectKueueVolcano
FocusJob queueingFull batch scheduler
Gang scheduling✅✅
Fair sharing✅✅
Topology awarenessLimited✅
CNCF StatusIncubatingIncubating

12. GPU Cost Optimization

The Five Strategies

StrategySavingsBest For
Spot instances70–91%Fault-tolerant training
Right-sizing GPU30–50%All workloads
MIG/time-slicing50–70%Inference
AutoscalingVariableInference
Reserved instances30–60%Predictable baseline

Training vs Inference Cost Profiles

AspectTrainingInference
PatternBatch, predictableContinuous, variable
DurationHours to days24/7
OptimizationSpot + checkpointingAutoscaling + sharing
CommitmentReserved instancesBaseline 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 SizeRecommended GPUVRAM
7B paramsA100 40GB16 GB (FP16)
13B paramsA100 40GB26 GB (FP16)
70B paramsA100 80GB / H100140 GB (FP16)
Fine-tuning 7BA100 40GB20 GB

Cost Per Token Optimization

For inference, the optimization goal is cost per token:

StrategyImpact
Mix GPU generationsH100 for prefill, A100 for decode
MIG for small modelsShare GPU across models
Autoscale on trafficScale to zero when idle
KV-cache optimizationReduce 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

ScenarioKata?
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.