aws-k8s-1.36-nvidia v1.66.0: NVIDIA driver libraries not mounted into containers with NVIDIA_VISIBLE_DEVICES envvar settings
Image I'm using:
Bottlerocket v1.66.0, variant aws-k8s-1.36-nvidia, architecture x86_64, kernel 6.18, NVIDIA driver 580.178.04 (lts branch). EC2 instance family: g4dn (NVIDIA T4). Selected via Karpenter EC2NodeClass:
amiSelectorTerms:
- alias: bottlerocket@latestNVIDIA related user data:
[settings.kubelet-device-plugins.nvidia]
device-list-strategy = "envvar"
[settings.nvidia-container-runtime]
visible-devices-as-volume-mounts = false
visible-devices-envvar-when-unprivileged = trueWhat I expected to happen:
A container requesting nvidia.com/gpu: 1, or an unprivileged container with NVIDIA_VISIBLE_DEVICES=all, gets the NVIDIA driver libraries (libnvidia-ml.so, libcuda.so, ...) mounted and nvidia-smi works. This is the behavior on v1.65.0 with the same variant, instance family and user data.
What actually happened:
On every v1.66.0 GPU node, nvidia-smi inside the container fails:
NVIDIA-SMI couldn't find libnvidia-ml.so library in your system. Please make sure that the NVIDIA Display Driver is properly installed and present in your system.
Please also try adding directory that contains libnvidia-ml.so to your system PATH.Device nodes, /proc/driver/nvidia and the NVIDIA binaries are mounted into the container, but no shared libraries are. grep -c '\.so' /proc/mounts inside the container returns 0 and ldconfig -p finds no NVIDIA libraries. Relevant /proc/mounts entries:
overlay /usr/bin/nvidia-smi overlay ro,...,lowerdir=/x86_64-bottlerocket-linux-gnu/sys-root/usr/share/.nvidia/lts/bin:/usr/bin,...
overlay /usr/lib/firmware/nvidia/580.178.04/gsp_tu10x.bin overlay ro,...,lowerdir=/x86_64-bottlerocket-linux-gnu/sys-root/usr/share/.nvidia/lts/lib64:/usr/lib64,...
tmpfs /proc/driver/nvidia tmpfs rw,...
devtmpfs /dev/nvidiactl devtmpfs ro,...
devtmpfs /dev/nvidia-uvm devtmpfs ro,...
devtmpfs /dev/nvidia0 devtmpfs ro,...Pinning the EC2NodeClass to [email protected] with no other change fixes it: the libraries are mounted and nvidia-smi works again.
The binaries and firmware are now mounted from /usr/share/.nvidia/lts/..., which looks like the per-branch driver layout from bottlerocket-os/bottlerocket-kernel-kit#536. The v1.66.0 release notes describe the NVIDIA dual-branch changes as k8s 1.37 only, but aws-k8s-1.36-nvidia also uses kernel 6.18 and seems to get the new layout. We suspect library discovery on the envvar / visible-devices-envvar-when-unprivileged path does not find the libraries in that layout. We have not tested the default (CDI) configuration.
How to reproduce the problem:
Launch an
aws-k8s-1.36-nvidiav1.66.0 node on a g4dn instance with the user data above.Run this pod:
apiVersion: v1 kind: Pod metadata: name: nvidia-smi-test spec: restartPolicy: Never tolerations: - operator: Exists containers: - name: test image: nvidia/cuda:12.4.1-base-ubuntu22.04 command: ["sh", "-c", "nvidia-smi; grep -c '\\.so' /proc/mounts"] resources: limits: nvidia.com/gpu: 1kubectl logs nvidia-smi-testshows the error above and0mounted.sofiles.Repeat on v1.65.0 with the same user data:
nvidia-smiworks.
Source: bottlerocket-os/bottlerocket