<p>I'm using <code>kubectl run</code> with environment parameters to create temporary docker containers for me (e.g. some forwarding for debugging purposes).
Since several weeks <code>kubectl</code> is complaining about <code>kubectl run</code> being deprecated. Unfortunately I can't find an appropriate replacement.</p>

<p>This is the old command:</p>

<pre><code>$KUBECTL run -i -t --attach=false --image djfaze/port-forward --env="REMOTE_HOST=$REMOTE_HOST" --env="REMOTE_PORT=$REMOTE_PORT" $POD_NAME
</code></pre>

<p>When issuing this, <code>kubectl</code> complains with this message:</p>

<blockquote>
  <p><code>kubectl run --generator=deployment/apps.v1beta1</code> is DEPRECATED and will be removed in a future version. Use kubectl create instead.</p>
</blockquote>

<p>Any ideas how to replace this run command?</p>

<p>As the author of the problem let me explain a little bit the intention behind this deprecation. Just like Brendan explains in <a href="https://stackoverflow.com/a/52902113">his answer</a>, <code>kubectl run</code> per se is not being deprecated, only all the generators, except for the one that creates a Pod for you.</p>

<p>The reason for this change is two folds:</p>

<ol>
<li><p>The vast majority of input parameters for <code>kubectl run</code> command is overwhelming for newcomers, as well as for the old timers. It's not that easy to figure out what will be the result of your invocation. You need to take into consideration several passed options as well as the server version.</p></li>
<li><p>The code behind it is also a mess to maintain given the matrix of possibilities is growing faster than we can handle.</p></li>
</ol>

<p>That's why we're trying to move people away from using <code>kubectl run</code> for their daily workflows and convince them that using explicit <code>kubectl create</code> commands is more straightforward. Finally, we want to make the newcomers that played with docker or any other container engine, where they run a container, to have the same experience with Kubernetes where <code>kubectl run</code> will just run a Pod in a cluster.</p>

<p>Sorry for the initial confusion and I hope this will clear things up.</p>

<p>UPDATE (2020/01/10): As of <a href="https://github.com/kubernetes/kubernetes/pull/87077" rel="noreferrer">https://github.com/kubernetes/kubernetes/pull/87077</a> <code>kubectl run</code> will ONLY create Pods. All generators will be removed entirely. </p>
