<p>Facing this error <strong>error: there was a problem with the editor &quot;vi&quot;</strong> when trying to change a deployment file in the Kubernetes cluster (AKS)</p>
<p><code>kubectl edit deploy xxxxx -o yaml</code></p>
<p>upon exiting the file, the below error is thrown with no changes applied.</p>
<p>This issue occurs only when trying to edit this particular deployment. Seems to work fine for other file changes</p>
<p>Few screenshots...</p>
<p><a href="https://i.stack.imgur.com/Fgrhs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Fgrhs.png" alt="enter image description here" /></a></p>
<p><a href="https://i.stack.imgur.com/1SJBL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1SJBL.png" alt="enter image description here" /></a></p>

<p>The issue is that kubectl is using vi instead of vim.</p>
<p>To resolve run (or add to your .bashrc or .bash_profile):</p>
<p><code>export EDITOR=vim</code></p>
<p>Then run your kubectl edit command.</p>
<p>Enjoy.</p>
