Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to edit a file in a running pod? #4

Open
Venryx opened this issue Nov 21, 2021 · 4 comments
Open

How to edit a file in a running pod? #4

Venryx opened this issue Nov 21, 2021 · 4 comments

Comments

@Venryx
Copy link

Venryx commented Nov 21, 2021

I am able to view the file-tree of running pods, and view the file contents, but how can I edit those files?

@Venryx
Copy link
Author

Venryx commented Nov 21, 2021

Nevermind, I figured it out:

  1. Right-click the remote file you want to edit, press "kubectl copy from", and save it somewhere on your local computer. (alternatively, you can right-click and press "View file", then copy-paste it into a local file)
  2. Edit that local copy of the file.
  3. Right click the folder parent of the original remote file, press "kubectl copy to from file", and select your edited local copy of the file.

However, there were three snags I hit with the above:

  1. The "kubectl copy from" command did not work for me at first, because the terminal I had open was already running a task; there should be a warning message that for the "kubectl" commands to work, the currently open terminal tab must be non-busy/accepting-commands.
  2. The "kubectl copy from" command failed even after opening a fresh terminal tab; this is because the cd \D [...] command it uses only works for CMD, not Powershell (the default, for me at least). In Powershell, the \D argument apparently needs to be removed.
  3. The "kubectl" commands failed for me even after the above, because the path it was copying to had spaces in it; when I manually reran the command with quotes added around the path, it succeeded.

Would you be open to pull-requests to fix these issues?

@mkamalkayani
Copy link

This feature would be a very useful addition to this extension.

@torsten-simon
Copy link

I've made a PR for exactly your requirements, hope it may gets merged :-)

@TSGames
Copy link

TSGames commented Feb 19, 2023

Unfortunately the PR was rejected without a reason, so I decided to fork it and created an own extension with editing functionality. It now also includes favorite files for quicker access (in beta):
https://marketplace.visualstudio.com/items?itemName=tsimones.kubernetes-file-system-explorer-editor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants