<p>I'm currently using Docker 19.03 and Kubernetes 1.13.5 and Rancher 2.2.4. Since 19.03, Docker has officially support natively NVIDIA GPUs just by passing <code>--gpus</code> option. Example (from <a href="https://github.com/NVIDIA/nvidia-docker/wiki/Installation-(Native-GPU-Support)#usage" rel="noreferrer">NVIDIA/nvidia-docker github</a>):</p>

<pre><code> docker run --gpus all nvidia/cuda nvidia-smi
</code></pre>

<p>But in Kubernetes, there's no option to pass Docker CLI options. So if I need to run a GPU instance, I have to install <code>nvidia-docker2</code>, which is not convenient to use.</p>

<p>Is there anyway to pass the Docker CLI options or passing NVIDIA runtime without installing <code>nvidia-docker2</code></p>

Aperture Prometheus
<p><a href="https://kubernetes.io/docs/tasks/manage-gpus/scheduling-gpus/" rel="nofollow noreferrer">GPU's are scheduled</a> via <a href="https://kubernetes.io/docs/concepts/cluster-administration/device-plugins" rel="nofollow noreferrer">device plugins</a> in Kubernetes.</p>
<blockquote>
<p>The <a href="https://github.com/NVIDIA/k8s-device-plugin" rel="nofollow noreferrer">official NVIDIA GPU device</a> plugin has the following requirements:</p>
<ul>
<li>Kubernetes nodes have to be pre-installed with NVIDIA drivers.</li>
<li>Kubernetes nodes have to be pre-installed with <a href="https://github.com/NVIDIA/k8s-device-plugin#preparing-your-gpu-nodes" rel="nofollow noreferrer">nvidia-docker 2.0</a></li>
<li>nvidia-container-runtime must be configured as the <a href="https://github.com/NVIDIA/k8s-device-plugin#preparing-your-gpu-nodes" rel="nofollow noreferrer">default runtime</a> for docker instead of runc.</li>
<li>NVIDIA drivers ~= 361.93</li>
</ul>
</blockquote>
<p>Once the nodes are setup GPU's become another resource in your spec like <code>cpu</code> or <code>memory</code>.</p>
<pre><code>spec:
  containers:
  - name: gpu-thing
    image: whatever
    resources:
      limits:
        nvidia.com/gpu: 1
</code></pre>
