Hello Guys, Does anyone know the kubectl edit command works on the windows? I am . . .

Lisan Haq:
Hello Guys,
Does anyone know the kubectl edit command works on the windows?
I am using Visual Studio Code to create the yaml files and set the windows environment to use the VSC, but it is still not working. I am getting the following error:
C:\Kubernetes>kubectl edit replicaset myapp-replicaset
error: unable to launch the editor “code --wait”

I set the windows env with the following command:
set EDITOR=code --wait

chris resnik:
EDITOR= should point to the executable you want to use as editor, I think

chris resnik:
e.g. EDITOR=“C:/Program Files/x86/vim/vim.exe”

chris resnik:
if code is your editor, you might just have to supply the full path

Lisan Haq:
I put the full path and it still doesn’t work:
Kubernetes>kubectl edit replicaset myapp-replicaset
‘"C:\Users\AppData\Local\Programs\Microsoft VS Code\Code.exe"’ is not recognized as an internal or external command,
operable program or batch file.
error: there was a problem with the editor “cmd /C "C:\Users\AppData\Local\Programs\Microsoft VS Code\Code.exe" --wait”

chris resnik:

  1. not sure about the preceding \ - is that to escape the ” ?
  2. > f you want to use a different editor, create an environment variable named KUBE_EDITOR with the value set to the path of your preferred text editor.
    https://docs.vmware.com/en/VMware-vSphere/7.0/vmware-vsphere-with-tanzu/GUID-DC2BB6E0-A327-4DB8-9A87-5F3376E70033.html

chris resnik:
they actually give this example:
> KUBE_EDITOR=code -w

Lisan Haq:
Thank you very much for your help! It still didn’t work. I got the following error:
C:\Users\Documents\Kubernetes>set KUBE_EDITOR=code -w

C:\Users\Documents\Kubernetes>kubectl edit replicaset myapp-replicaset
error: unable to launch the editor “code -w”

Instead of wasting time on this. I decided to use powershell and it allows me to edit it.

chris resnik:
sorry to hear about this :disappointed: but good to hear that it works in powershell :thumbsup: