Fix GPU pipeline failure in Kubernetes/GKE (libcuda.so.1 and nvidia-smi PATH)
Motivation / Context
When running the ODM GPU image in Kubernetes, specifically on GKE with GPU node pools, the pipeline fails because the container cannot locate nvidia-smi or libcuda.so.1. This happens because the driver binaries and libraries mounted by the Kubernetes device plugin aren't in the default PATH or LD_LIBRARY_PATH.
This issue surfaced recently because the base NVIDIA image has been changed. Some NVIDIA images have these paths baked in by default, but nvidia/cuda:12.9.1-runtime-ubuntu24.04 requires them to be set explicitly.
Changes Made
This PR introduces a minimal update to the GPU Dockerfile to explicitly add the required NVIDIA paths, ensuring the runtime can correctly interface with the underlying GPU drivers.
Fixes: #2001
Verification / Proof of Fix
To verify this, I ran a simple test pod requesting a GPU and executing nvidia-smi.
Before (Current opendronemap/odm:gpu) ❌
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
meta
name: odm-nvidia-smi
spec:
nodeSelector:
node_pool: gpu-node-pool
tolerations:
- key: "nvidia.com/gpu"
operator: "Equal"
value: "present"
effect: "NoSchedule"
containers:
- name: odm-nvidia-smi
image: opendronemap/odm:gpu
command: ["sh", "-c"]
args: ["nvidia-smi"]
resources:
limits:
nvidia.com/gpu: 1
restartPolicy: Never
EOF
Logs:
$ kubectl logs odm-nvidia-smi
sh: 1: nvidia-smi: not found
After (Built with PR changes) ✅
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
meta
name: odm-nvidia-smi
spec:
nodeSelector:
node_pool: gpu-node-pool
tolerations:
- key: "nvidia.com/gpu"
operator: "Equal"
value: "present"
effect: "NoSchedule"
containers:
- name: odm-nvidia-smi
image: $GCP_AR_URL/opendronemap/odm:gpu # Custom image with this PR's commit
command: ["sh", "-c"]
args: ["nvidia-smi"]
resources:
limits:
nvidia.com/gpu: 1
restartPolicy: Never
EOF
Logs:
$ kubectl logs odm-nvidia-smi
Thu Mar 12 09:29:52 2026
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.274.02 Driver Version: 535.274.02 CUDA Version: 12.2 |
|-----------------------------------------+----------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+======================+======================|
| 0 Tesla T4 Off | 00000000:00:04.0 Off | 0 |
| N/A 37C P8 9W / 70W | 2MiB / 15360MiB | 0% Default |
| | | N/A |
+-----------------------------------------+----------------------+----------------------+
+---------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=======================================================================================|
| No running processes found |
+---------------------------------------------------------------------------------------+
I can also confirm that we've got this latest image running end-to-end in our odm tasks.
cc: @spwoodcock @DodgySpaniard
Thanks so much for the detailed write up @Connah-rs!
I'll test this as soon as I can =)
I thought I would try to verify outside of Kubernetes first.
EC2 + Docker Tests
Methodology below.
Start up an g4dn.xlarge instance on AWS with
AMI: ami-0a7300e10f97b6153
(Deep Learning OSS Nvidia Driver AMI GPU PyTorch 2.10 (Ubuntu 24.04))
I added a 70GB gp3 disk, as it ran out of space building on 30GB
~Install docker~
[!NOTE] Not required in pre-configured AMI!
curl -fsSL https://get.docker.com -o install-docker.sh
sudo sh install-docker.sh
~Install Nvidia container toolkit~
[!NOTE] Not required in pre-configured AMI
https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html
sudo apt-get update && sudo apt-get install -y --no-install-recommends \
ca-certificates \
curl \
gnupg2
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
&& curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
sudo apt-get update
export NVIDIA_CONTAINER_TOOLKIT_VERSION=1.19.0-1
sudo apt-get install -y \
nvidia-container-toolkit=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
nvidia-container-toolkit-base=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
libnvidia-container-tools=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
libnvidia-container1=${NVIDIA_CONTAINER_TOOLKIT_VERSION}
sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker
Verify nvidia drivers
sudo docker run --rm --gpus all --entrypoint bash
docker.io/nvidia/cuda:12.9.1-runtime-ubuntu24.04 -lc '
set -e
echo "PATH=$PATH"
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
echo "nvidia-smi: $(command -v nvidia-smi || echo not-found)"
ldconfig -p | grep libcuda.so.1 || true
nvidia-smi
'
Output:
PATH=/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
LD_LIBRARY_PATH=/usr/local/cuda/lib64
nvidia-smi: /usr/bin/nvidia-smi
libcuda.so.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libcuda.so.1
Fri Mar 13 17:15:39 2026
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 580.126.09 Driver Version: 580.126.09 CUDA Version: 13.0 |
+-----------------------------------------+------------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 Tesla T4 On | 00000000:00:1E.0 Off | 0 |
| N/A 23C P8 12W / 70W | 0MiB / 15360MiB | 0% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+
+-----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
| No running processes found |
+-----------------------------------------------------------------------------------------+
Looks like LD_LIBRARY_PATH=/usr/local/cuda/lib64, in this PR we add
to add in /usr/local/nvidia/lib64:/usr/local/nvidia/lib
I checked those paths in the base image:
[ec2-user@ip-172-31-48-207 ~]$ ls /usr/local/nvidia/lib64
ls: cannot access '/usr/local/nvidia/lib64': No such file or directory
[ec2-user@ip-172-31-48-207 ~]$ ls /usr/local/nvidia/lib
ls: cannot access '/usr/local/nvidia/lib': No such file or directory
They don't exist... but we can check again in the final ODM images below.
Verify current ODM image
sudo docker run --rm --gpus all --entrypoint bash \
docker.io/opendronemap/odm:gpu -lc '
echo "PATH=$PATH"
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
which nvidia-smi || true
ldconfig -p | grep libcuda.so.1 || true
python3 - <<PY
import ctypes
try:
ctypes.CDLL("libcuda.so.1")
print("libcuda.so.1: OK")
except OSError as e:
print("libcuda.so.1: FAIL:", e)
PY
nvidia-smi
'
Output:
PATH=/code/venv/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
LD_LIBRARY_PATH=/usr/local/cuda/lib64:/code/SuperBuild/install/lib
/usr/bin/nvidia-smi
libcuda.so.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libcuda.so.1
libcuda.so.1: OK
Fri Mar 13 17:08:08 2026
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 580.126.09 Driver Version: 580.126.09 CUDA Version: 13.0 |
+-----------------------------------------+------------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 Tesla T4 On | 00000000:00:1E.0 Off | 0 |
| N/A 23C P8 12W / 70W | 0MiB / 15360MiB | 0% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+
+-----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
| No running processes found |
+-----------------------------------------------------------------------------------------+
Verify this PR
Clone and checkout to PR:
git clone https://github.com/OpenDroneMap/ODM.git
cd ODM
# Add the contributor's fork
git remote add outfieldtech https://github.com/outfieldtech/ODM.git
# Fetch and checkout the PR branch
git fetch outfieldtech bugfix/gke-gpu-nvidia-smi-missing
git checkout bugfix/gke-gpu-nvidia-smi-missing
Build:
docker build -f gpu.Dockerfile \
-t opendronemap/odm:gke-gpu-nvidia-smi-missing .
But no need to run the test, as the PR only adds to the env vars - if it worked on the currently published ODM image, then it works using Docker! (I did run it just in case & no issues).
Conclusion
Interestingly, the current opendronemap/odm:gpu image works correctly when run directly via Docker with --gpus all.
Perhaps this suggests the NVIDIA container runtime is injecting the driver libraries and binaries correctly into the container, hence no error?
The issue likely only manifests in Kubernetes environments where the device plugin mounts driver libraries differently and may rely on /usr/local/nvidia/* being present in PATH and LD_LIBRARY_PATH.
[!NOTE] This has got me thinking about where we are at for GPU support using nerdctl / containerd (this PR may fix that, as many k8s distros also use containerd), podman, and others. If it's not reported, it ain't broke! 😆
Posting k8s tests below...
EC2 + k8s Test
Install k8s via k3s
curl -sfL https://get.k3s.io | sh -
# config permissions
sudo chown $(id -u):$(id -g) /etc/rancher/k3s/k3s.yaml
# then
kubectl get nodes
Install the nvidia helm operator
# first, install the helm utility
sudo snap install helm --classic
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
helm repo add nvidia https://helm.ngc.nvidia.com/nvidia
helm repo update
helm install --wait nvidiagpu \
-n gpu-operator --create-namespace \
--set toolkit.env[0].name=CONTAINERD_CONFIG \
--set toolkit.env[0].value=/var/lib/rancher/k3s/agent/etc/containerd/config.toml \
--set toolkit.env[1].name=CONTAINERD_SOCKET \
--set toolkit.env[1].value=/run/k3s/containerd/containerd.sock \
--set toolkit.env[2].name=CONTAINERD_RUNTIME_CLASS \
--set toolkit.env[2].value=nvidia \
--set toolkit.env[3].name=CONTAINERD_SET_AS_DEFAULT \
--set-string toolkit.env[3].value=true \
nvidia/gpu-operator
Test GPU working:
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
name: gpu-pod
spec:
restartPolicy: OnFailure
runtimeClassName: nvidia
containers:
- name: cuda-container
image: nvidia/cuda:11.6.2-base-ubuntu20.04
command: ["nvidia-smi"]
resources:
limits:
nvidia.com/gpu: 1 # requesting 1 GPU
EOF
Check with kubectl logs gpu-pod
Verify failure on current image
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
name: odm-nvidia-test
spec:
restartPolicy: Never
containers:
- name: odm
image: opendronemap/odm:gpu
command: ["sh", "-c"]
args: ["nvidia-smi"]
resources:
limits:
nvidia.com/gpu: 1
EOF
Output:
kubectl describe pod/odm-nvidia-test
Name: odm-nvidia-test
Namespace: default
Priority: 0
Service Account: default
Node: ip-172-31-48-75/172.31.48.75
Start Time: Fri, 13 Mar 2026 19:44:52 +0000
Labels: <none>
Annotations: <none>
Status: Succeeded
IP: 10.42.0.22
IPs:
IP: 10.42.0.22
Containers:
odm:
Container ID: containerd://691a7324f98a726d61c90a48fd60553a00d707edb67813f619f0937700ba4d0e
Image: opendronemap/odm:gpu
Image ID: docker.io/opendronemap/odm@sha256:e9a55fcaf1dac96890265a6a61dd59c83d51403426d40763d99c48dd82670a47
Port: <none>
Host Port: <none>
Command:
sh
-c
Args:
nvidia-smi
State: Terminated
Reason: Completed
Exit Code: 0
Started: Fri, 13 Mar 2026 19:46:18 +0000
Finished: Fri, 13 Mar 2026 19:46:18 +0000
Ready: False
Restart Count: 0
Limits:
nvidia.com/gpu: 1
Requests:
nvidia.com/gpu: 1
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-lr8f4 (ro)
Conditions:
Type Status
PodReadyToStartContainers False
Initialized True
Ready False
ContainersReady False
PodScheduled True
Volumes:
kube-api-access-lr8f4:
Type: Projected (a volume that contains injected data from multiple sources)
TokenExpirationSeconds: 3607
ConfigMapName: kube-root-ca.crt
Optional: false
DownwardAPI: true
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 100s default-scheduler Successfully assigned default/odm-nvidia-test to ip-172-31-48-75
Normal Pulling 100s kubelet Pulling image "opendronemap/odm:gpu"
Normal Pulled 15s kubelet Successfully pulled image "opendronemap/odm:gpu" in 1m25.163s (1m25.163s including waiting). Image size: 3225926637 bytes.
Normal Created 15s kubelet Created container: odm
Normal Started 15s kubelet Started container odm
ubuntu@ip-172-31-48-75:~$ kubectl logs pod/odm-nvidia-test
Fri Mar 13 19:46:18 2026
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 580.126.16 Driver Version: 580.126.16 CUDA Version: 13.0 |
+-----------------------------------------+------------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 Tesla T4 On | 00000000:00:1E.0 Off | 0 |
| N/A 22C P8 14W / 70W | 0MiB / 15360MiB | 0% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+
+-----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
| No running processes found |
+-----------------------------------------------------------------------------------------+
Looks like everything is working fine in opendronemap/odm:gpu!
Doh, I completely missed this is on GKE! I have never used or had an account on GKE.
My stack: AWS EC2, Ubuntu
- k3s
- containerd
- nvidia-container-toolkit
- NVIDIA device plugin
As GKE has it's own Google GPU driver installer, I assume it installs to paths:
/usr/local/nvidia/bin
/usr/local/nvidia/lib64
As this test is additive only to the env vars, and has thorough documentation confirming it works in GKE (+ I confirm no issues in AWS-based Ubuntu & Amazon Linux), I'd say this is good to merge!
Thanks for the review, @spwoodcock. I was surprised the current image works fine with k3s on EC2 - I’m using GKE’s managed drivers, so these paths must be specific to GKE rather than Kubernetes in general. Thanks for approving the fix for this edge case! I’ve incorporated your requested comments.