Repository navigation
[Bug]: default-kind management.nvidia.com/gpu incompatible with non-cdi strategies, making GPU pods unresolable #3077
Description
Describe the bug
The operator sets default-kind to management.nvidia.com/gpu, and that kind contains only the "all" device by design. Any device list that arrives as bare names therefore cannot resolve in CDI mode: it is qualified with a kind that is guaranteed not to contain it. That makes the volume-mounts device list strategy and ACCEPT_NVIDIA_VISIBLE_DEVICES_AS_VOLUME_MOUNTS incompatible with cdi.enabled.
To Reproduce
- Deploy GPU Operator with cdi.enabled=true.
- Set
devicePlugin.env.DEVICE_LIST_STRATEGY=cdi-cri,cdi-annotations,volume-mountsandtoolkit.env.ACCEPT_NVIDIA_VISIBLE_DEVICES_AS_VOLUME_MOUNTS=truein ClusterPolicy. - Run a pod requesting nvidia.com/gpu: 1 with
runtimeClassName: nvidia.
apiVersion: v1
kind: Pod
metadata:
name: test-cdi-device-plugin
namespace: cdi-test
spec:
tolerations:
- key: nvidia.com/gpu
value: "true"
effect: NoSchedule
restartPolicy: Never
containers:
- name: gpu-test
image: nvcr.io/nvidia/cuda:13.0.0-base-ubuntu24.04
command: ["sh", "-c", "nvidia-smi -L"]
resources:
limits:
nvidia.com/gpu: 1
The container never starts with error -
Normal Pulling 12s kubelet spec.containers{gpu-test}: Pulling image "nvcr.io/nvidia/cuda:13.0.0-base-ubuntu24.04"
Normal Pulled 8s kubelet spec.containers{gpu-test}: Successfully pulled image "nvcr.io/nvidia/cuda:13.0.0-base-ubuntu24.04" in 4.301s (4.301s including waiting). Image size: 139357825 bytes.
Normal Created 8s kubelet spec.containers{gpu-test}: Container created
Warning Failed 8s kubelet spec.containers{gpu-test}: Error: failed to create containerd task: failed to create shim task: OCI runtime create failed: could not apply required modification to OCI specification: error modifying OCI spec: failed to inject CDI devices: unresolvable CDI devices management.nvidia.com/gpu=GPU-67fa9265-2b87-d8ce-e708-13e93416062c
Expected behavior
(1) The management.nvidia.com/gpu as default shouldn't get applies on workload pods.
(2) It would help if the CDI page stated that when CDI is enabled, DEVICE_LIST_STRATEGY must contain only CDI strategies and ACCEPT_NVIDIA_VISIBLE_DEVICES_AS_VOLUME_MOUNTS must be unset in ClusterPolicy - https://docs.nvidia.com/datacenter/cloud-native/gpu-operator/25.10/cdi.html#about-the-container-device-interfacehttps://docs.nvidia.com/datacenter/cloud-native/gpu-operator/25.10/cdi.html#about-the-container-device-interface
Environment (please provide the following information):
GPU operator: v25.10
nvidia-container-toolkit version: v1.18.1
NVIDIA Driver Version: 580.126.20
Host OS: Ubuntu 24.04.4 LTS
Kernel Version: 6.8.0-1046-nvidia
Container Runtime Version: bundled with v1.35.2+rke2r1
CPU Architecture x86_64 and arm64
GPU Model(s): B200, H100
Activity
aditighag commentedon Oct 15, 2026
Moving the Slack conversation with @tariq1890 here for visibility -
@tariq1890
tariq1890 commentedon Oct 15, 2026
Thank you @aditighag
I have raised this PR to address this issue - #3081
tariq1890 commentedon Oct 15, 2026
Reading through your bug report more, I see that PR #3081 does not fully resolve this issue.
cdesiniotis commentedon Oct 19, 2026
Thanks @aditighag for filing this issue with detailed repro steps. I was able to reproduce this and have a better handle on what is going on here.
The exact sequence is as follows:
Allocate()call to the device-pluginContainerAllocateResponse:i. Fully-qualified CDI device name(s) in the
CDIDevicesfieldii. Fully-qualified CDI device name(s) in the container
Annotationsiii. One
Mountper device idi. Note, our CDI spec sets the
NVIDIA_VISIBLE_DEVICESenvvar tovoidto prevent the NVIDIA Container Runtime from also attempting to inject devices (in case it gets invoked).i. It does NOT find any CDI devices specified through container annotations (this is not expected, more on this later)
ii. It gets the device list from volume mounts, since
accept-nvidia-visible-devices-as-volume-mountsistrue. It prefers volume mounts over the envvar.iii. The
nvidiaruntime is running incdimode, so it constructs a fully-qualified CDI device name by prepending the default CDI kind (management.nvidia.com/gpu) to the device id found via the volume mountiv. The
nvidiaruntime fails to resolve the CDI deviceIn my opinion, the "right" fix here is to add an additional guardrail to prevent duplicate device injection from the
nvidiaruntime when containerd (or cri-o) is already injecting the CDI device(s) for us. We have precedent for this as we setNVIDIA_VISIBLE_DEVICES=voidin our CDI specs today for this exact purpose (for theenvvarstrategy). I have raised NVIDIA/nvidia-container-toolkit#2146 which provides a similar guardrail for when the volume-mounts strategy is configured.While investigating this, I noticed that the CDI device annnotations (set by the device-plugin) were not making it to the resulting OCI runtime spec. I have raised a fix for this: #3088.
aditighag commentedon Oct 20, 2026
Thanks for the detailed notes. The approach in NVIDIA/nvidia-container-toolkit#2146 looks right for the reported failure. I have a question about backward compatibility, so I'll follow it up on the PR.
There are two (related) cases that are not tackled:
CDI enabled with no CDI strategy. If
DEVICE_LIST_STRATEGYis volume-mounts alone, containerd never injects a CDI device, so the void mount never arrives and the bare device ids still get qualified with default-kind. Can we add a guardrail for such cases?Self-declared mounts. A pod that requests no GPU but mounts
/dev/nullat/var/run/nvidia-container-devices/allgets no CDI injection, hence no void mount, and all resolves against the management kind to every GPU on the node. Can GPU operator protect against such foot guns? I'm ok if we want to handle this in a separate follow-up.cdesiniotis commentedon Oct 21, 2026
Yes #3081 is the guardrail we are planning for this, to prevent users from configuring a
DEVICE_LIST_STRATEGYenvvar that is incompatible with thecdi.enabledsetting in the gpu-operator.While this scenario is technically possible, I don't believe this is a significant problem in practice since any reasonable Kubernetes cluster disallows host volume mounts for unprivileged containers (this is the assumption that was made when we introduced the volume mounts strategy in the first place). I am happy to hear any ideas you may have on how to harden against this scenario, if possible.