I'm currently working with a program called kubernetes. I open a file locally with the command "kubectl edit deployment/deployment-name" on my command line. This gives me a .txt file that I can then save that will be reuploaded.

When opening .txt files from my file explorer, it opens properly in my default program, VS Code, but in this instance it opens in Notepad.

Anyone have ideas how to get this to work and have the file open in the proper program?

  • Are you sure the problem is Windows and not, say, kubectl itself?
    – Daniel B
    Feb 17 '20 at 7:16
  • I'm not sure and I wouldn't quite know how to test this with another program. Do you have any ideas? Feb 17 '20 at 7:21

From the kubectl edit documentation:

It will open the editor defined by your KUBE_EDITOR, or EDITOR environment variables, or fall back to 'vi' for Linux or 'notepad' for Windows.

kubectl simply does not use file associations, a Windows UI concept. If you want to use a different editor, you need to use the environment variables described. Be aware that other cross-platform utilities may also use the EDITOR environment variable.

If you absolutely have to use file associations, you’ll have to find (or create) a wrapper program. I didn’t find any in a quick search.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.