When is it recommended to use `edit pod` command or delete and recreate a new po . . .

Sidd:
When is it recommended to use edit pod command or delete and recreate a new pod with yaml file?

Mohamed Ayman:
Kubectl edit command is used when you created pod with definitional.yaml file and not with “kubectl run” command.
Otherwise, Kubectl edit command changes will be redirected to temporary file and then you need to delete already created object and re-create with kubectl apply -f “path of temporary file” .

Kubectl edit command is used when you created pod with definitional.yaml file and not with “kubectl run” command.
Otherwise, Kubectl edit command changes will be redirected to temporary file and then you need to delete already created object and re-create with kubectl apply -f “path of temporary file” .

But the best practice is to use:

$ kubectl run --image= --dry-run=client -o yaml > podyaml

This will create .yaml file and then create object using
"kubectl *create -*f or kubectl apply -f "

Then you can make changes directly in .yaml file.

Sidd:
Thanks, this helps.