NVIDIA / gpu-operator

NVIDIA GPU Operator creates, configures, and manages GPUs in Kubernetes
https://docs.nvidia.com/datacenter/cloud-native/gpu-operator/latest/index.html
Apache License 2.0
1.8k stars 291 forks source link

How to modify /etc/nvidia-container-runtime/config.toml? #1027

Open janetat opened 1 week ago

janetat commented 1 week ago

How to modify /etc/nvidia-container-runtime/config.toml in nvidia-contianer-toolkit-daemonset-xxx installed by helm? I need accept-nvidia-visible-devices-envvar-when-unprivileged = true

cdesiniotis commented 1 week ago

You can do this by configuring the following environment variable in ClusterPolicy:

toolkit:
  env:
  - name: ACCEPT_NVIDIA_VISIBLE_DEVICES_ENVVAR_WHEN_UNPRIVILEGED
    value: "true"

Note that "true" is the default value for this field in the config file.

astranero commented 1 week ago

Small example of doing it using helm directly

microk8s helm install nvidia/gpu-operator --generate-name -n gpu-operator-resources --version 24.6.1 $HELM_OPTIONS \
  --set toolkit.env[4].name=ACCEPT_NVIDIA_VISIBLE_DEVICES_ENVVAR_WHEN_UNPRIVILEGED \
  --set-string toolkit.env[4].value=true \
  --set toolkit.env[5].name=ACCEPT_NVIDIA_VISIBLE_DEVICES_AS_VOLUME_MOUNTS \
  --set-string toolkit.env[5].value=false \
  --set devicePlugin.env[0].name=DEVICE_LIST_STRATEGY \
  --set devicePlugin.env[0].value="envvar" \
  --set driver.enabled=false