<p>I am kubernetes newbie, and I have a basic question</p>

<p>my understanding from <a href="https://kubernetes.io/docs/reference/kubectl/conventions/" rel="nofollow noreferrer">https://kubernetes.io/docs/reference/kubectl/conventions/</a> is , we can generate yaml templates using "kubernetes run" command</p>

<p>But when I tried doing same, it didn't work as expected</p>

<pre><code>kubectl run deployment-sample --image deployment-sample --dry-run -o yaml --generator=extensions/v1beta1
error: generator "extensions/v1beta1" not found


kubectl run deployment-sample --image deployment-sample --dry-run -o yaml --generator=apps/v1beta1
error: generator "apps/v1beta1" not found
</code></pre>

<p>Not sure if my understanding is wrong or something wrong in my command ?</p>

<p>I am on kubernetes 1.11</p>

<p>I find that I can create a Deployment with <code>kubectl run --generator=deployment/v1beta1 foobar --image=nginx -o yaml --dry-run</code> so your case would be <code>kubectl run --generator=deployment/v1beta1 deployment-sample --image=deployment-sample -o yaml --dry-run</code>. The kubectl conventions page you refer to does say this generator is 'recommended' for Deployments. </p>

<p>But I'm not sure why the docs list a non-recommended generator option that actually doesn't work. For a command like this you can recreate the expected output in a reference environment through the online tutorials at <a href="https://kubernetes.io/docs/tutorials/kubernetes-basics/create-cluster/cluster-interactive/" rel="nofollow noreferrer">https://kubernetes.io/docs/tutorials/kubernetes-basics/create-cluster/cluster-interactive/</a> You get the same output there so it is not just you or your cluster. My best guess is that 'extensions/v1beta1' <a href="https://kubernetes.io/docs/reference/federation/extensions/v1beta1/definitions/" rel="nofollow noreferrer">is too general to match to a deployment specifically</a>. It <a href="https://github.com/kubernetes/website/issues/12090" rel="nofollow noreferrer">could well be that the documentation needs changing on this</a>. </p>
