<p>I configured a Kubernetes cluster with GPU in AWS, and one of the steps is configuring the nodes to enable Nvidia runtime by default.</p>
<p>So when I configured cluster auto scaler, the cluster scales up successfully but the new node still needs to be configured to use Nvidia as a default runtime.</p>
<p>My goal is to configure this step automatically, I wonder if there is a way to do this with Kubernetes, like specifying the commands to execute in startup in the instance group. (just like in GCP where you are able to define a startup script or in AWS called a user data for launching scripts).</p>
<p>Thanks!</p>

Sadmi
<p>I found an interesting resource <a href="https://kops.sigs.k8s.io/instance_groups/#additionaluserdata" rel="nofollow noreferrer">here</a> that helped me to achieve my goal above.</p>
<p>so the it's possible to define additional user data section in the instance group configuration.</p>
<p>In my case I was about to enable Nvidia runtime which I achieved as follows:</p>
<pre><code>spec:
  additionalUserData:
  - content: |
      #!/bin/sh
      sudo sed -i '2i &quot;default-runtime&quot;: &quot;nvidia&quot;,' /etc/docker/daemon.json &amp;&amp; sudo systemctl restart docker
    name: script.sh
    type: text/x-shellscript 
</code></pre>
