kubectl edit deployment not working but kubectl apply is working while setting up resource req/limit on deployment

4/11/2020

I am trying to add resource request and limit on an existing deployment. when I do kubectl edit deployment deployment_name_here, edit the yaml and save and exit, it give me this : Edit cancelled, no changes made.

but when I edit the yaml,that I used to create that deployment and add the resource details, and do kubectl apply -f deployment.yaml it works.

Why this is happening? Is there any way I can do it directly using kubectl edit ...

-- shashank patel
kubernetes
kubernetes-deployment

1 Answer

4/11/2020

Things like this are most likely caused by it opening an editor that forks off instead of staying.

That means you'll want to set $EDITOR to an editor that does wait. E.g. nano, vim or emacs should work.

-- Arghya Sadhu
Source: StackOverflow