when do we use these individual approaches ?
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.