<p>One of the points in the <code>kubectl</code> <a href="https://kubernetes.io/docs/reference/kubectl/conventions/#best-practices" rel="nofollow noreferrer">best practices section in Kubernetes Docs</a> state below:</p>

<blockquote>
  <p>Pin to a specific generator version, such as <code>kubectl run
  --generator=deployment/v1beta1</code></p>
</blockquote>

<p>But then a little down in the doc, we get to learn that except for Pod, the use of <code>--generator</code> option is deprecated and that it would be removed in future versions.</p>

<p>Why is this being done? Doesn't generator make life easier in creating a template file for resource definition of deployment, service, and other resources? What alternative is the kubernetes team suggesting? This isn't there in the docs :(</p>

<p><code>kubectl create</code> is the recommended alternative if you want to use more than just a pod (like deployment).</p>

<p><a href="https://kubernetes.io/docs/reference/kubectl/conventions/#generators" rel="nofollow noreferrer">https://kubernetes.io/docs/reference/kubectl/conventions/#generators</a> says:</p>

<blockquote>
  <p>Note: <code>kubectl run --generator</code> except for <code>run-pod/v1</code> is deprecated in v1.12.</p>
</blockquote>

<p><a href="https://github.com/kubernetes/kubernetes/pull/68132" rel="nofollow noreferrer">This pull</a> request has the reason why generators (except <code>run-pod/v1</code>) were deprecated:</p>

<blockquote>
  <p>The direction is that we want to move away from <code>kubectl run</code> because it's over bloated and complicated for both users and developers. We want to mimic <code>docker run</code> with <code>kubectl run</code> so that it <em>only</em> creates a pod, and if you're interested in other resources <code>kubectl create</code> is the intended replacement.</p>
</blockquote>
