<p>In my Kubernetes config.yaml  I have:</p>
<pre><code>command: [&quot;sh&quot;, &quot;-c&quot;, &quot;command1; command2; command3;&quot;]`
</code></pre>
<p>a lot of commands can complicate the config file and it will be hard to reat. What is the best approach here? Is it possible to create a script that will have those commands? I will be glad to see an example.</p>

vesii
<p>Two ways:</p>
<p><strong>The quick and dirty way .</strong></p>
<p>The command object a an array object in yaml so you can reformat like.</p>
<pre><code>command:
 - &quot;sh&quot;
 - &quot;-c&quot;
 - &quot;command1; command2; command3;&quot;
 - &quot;ect&quot;
</code></pre>
<p><strong>A little more elegant way:</strong></p>
<ul>
<li>Create a config map object as a shell script with all your commands.</li>
<li>Attach that config map as a mounted volume to your deployment/statefulset, cron , ect. object</li>
<li>Call the shell script from your command</li>
</ul>
<p><a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#create-configmaps-from-files" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#create-configmaps-from-files</a></p>
