Kubectl run busybox --image=busybox --restart=Never -- /bin/sh -c sleep 3600' -- . . .

Rahul:
kubectl run busybox --image=busybox --restart=Never – /bin/sh -c sleep 3600’ --dry-run=client -o yaml > pod.yaml - This does not work

kubectl run busybox --image=busybox --restart=Never -o yaml --dry-run=client – /bin/sh -c ‘sleep 3600’ > pod.yaml - This works

Sorry for basic question. Can anyone explain the reason

Samuel Begin:
you are missing a single quote

Rahul:
My bad . Thank you so much :slightly_smiling_face:

Rahul:
Writing command before dry-run=client does not create the YAML

Hinodeya learn:
I think he knew that

JohnC:
I believe its due to the command line seeing the “–” and then considers EVERYTHING after to be the command, so the --dry-run is thought to be part of the command and args.

Ashwaq Hussain:
@JohnC - true what I observe is the same, when ever you pass command argument everything after ‘–’ is considered as a command by kubectl. May be this is due to the k8 version