I am kubernetes newbie, and I have a basic question
my understanding from https://kubernetes.io/docs/reference/kubectl/conventions/ is , we can generate yaml templates using "kubernetes run" command
But when I tried doing same, it didn't work as expected
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
Not sure if my understanding is wrong or something wrong in my command ?
I am on kubernetes 1.11
I find that I can create a Deployment with kubectl run --generator=deployment/v1beta1 foobar --image=nginx -o yaml --dry-run
so your case would be kubectl run --generator=deployment/v1beta1 deployment-sample --image=deployment-sample -o yaml --dry-run
. The kubectl conventions page you refer to does say this generator is 'recommended' for Deployments.
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 https://kubernetes.io/docs/tutorials/kubernetes-basics/create-cluster/cluster-interactive/ You get the same output there so it is not just you or your cluster. My best guess is that 'extensions/v1beta1' is too general to match to a deployment specifically. It could well be that the documentation needs changing on this.