Question. Is it possible to use the `--command` and `--dry-run` flags together? . . .

Saurav Kunwar:
Question. Is it possible to use the --command and --dry-run flags together? When I run something like
k run pod-name --iamge nginx --command -- sh -c sleep 5000 --dry-run=client -o yaml > pn.yaml
the pod gets created and the --dry-run=client shows up within the container as a command like below:

  • command:
    • sh
    • -c
    • sleep
    • “4800”
    • –dry-run=client
    • -o
    • yaml

What am I doing wrong?

Tej_Singh_Rana:
Hello, @Saurav Kunwar
Yeah, it’s possible. Just use it before double hyphen (–).

Hinodeya Rock:
k run pod-name --image nginx --dry-run=client – sleep 5000 -o yaml > pn.yaml

Saurav Kunwar:
Thanks! That works