<p>When using <code>kubectl run -ti</code> with an interactive terminal, I would like to be able to pass a few commands in the <code>kubectl run</code> command to be run before the interactive terminal comes up, commands like <code>apt install zip</code> for example. In this way, I do not need to wait for the interactive terminal to come up and then run those common commands. Is there a way do so this?</p>
<p>Thanks</p>

<p>You can use the shell's <code>exec</code> to hand control over from your initial &quot;outer&quot; bash, responsible for doing the initialization steps you want, over to a fresh one (fresh in the sense that it does not have <code>-c</code> and can optionally be a login shell) which runs after your pre-steps:</p>
<pre class="lang-sh prettyprint-override"><code>kubectl run sample -it --image=ubuntu:20.04 -- \
    bash -c &quot;apt update; apt install -y zip; exec bash -il&quot;
</code></pre>
