ameya agashe:
I used --dry-client=server still no charm
root@controlplane:/etc/kubernetes/manifests# k run static-busybox --image=busybox --command -- sleep 1000 --dry-run=client --restart=Never -oyaml >> pod.yaml
Error from server (AlreadyExists): pods "static-busybox" already exists
root@controlplane:/etc/kubernetes/manifests# k delete po static-busybox
pod "static-busybox" deleted
root@controlplane:/etc/kubernetes/manifests#
Adeola Adefolaju:
@ameya agashe try this
ameya agashe:
I have completed that lab, I was doing pretty much same way but – sleep 1000 you seems to have passed without –
unnivkn:
Hi @ameya agashe you can do it with --dry-run=server as well. Any way, the purpose of --dry-run=server is different than --dry-run=client . If you like to get the complete yaml output of k get po my-pod -o yaml
, with out creating it you can use it like this: k run my-pod --image=nginx --dry-run=server -o yaml
ameya agashe:
Sure, thank you @unnivkn
Radoslaw Czajkowski:
I think that with this syntax it tries to create a pod anyway - it takes everyting after “–command” as arguments of command
Radoslaw Czajkowski:
so it tried to run a pod with those arguments and the pod already existed - hence the error
Radoslaw Czajkowski:
try to change the order of the arguments
Radoslaw Czajkowski:
k run static-busybox --image=busybox --dry-run=client --restart=Never --command – sleep 1000 -oyaml >> pod.yaml
kubectl run --restart=Never --image=busybox static-busybox --dry-run=client -o yaml --command – sleep 1000 > /etc/kubernetes/manifests/static-busybox.yaml