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

Add support for browsing file system of Kubernetes pods (containers) #644

Open
sandipchitale opened this issue Nov 1, 2019 · 7 comments
Open

Comments

@sandipchitale
Copy link

@sandipchitale sandipchitale commented Nov 1, 2019

For example see: https://marketplace.visualstudio.com/items?itemName=sandipchitale.kubernetes-file-system-explorer.

Basically uses:

kubectl exec -it podname -c containername -- ls /

to get the listings of files starting at /. Show them as tree nodes. Also using the command:

kubectl exec -it podname -c containername -- cat /path/to/file

and showing the returned content in a editor.

BTW the extension also shows the initContainers and Containers in a pod. Shows the filesystems of the running containers.

Both supported by the extension above.

Lastly even better option would be to support dual pane file browser for local and container filesystem. Use the the:

kubectl cp fom podname:/to

to copy files from/to.

Use the https://code.visualstudio.com/api/references/vscode-api#FileSystemProvider API to implement the container filesystem browser.

@itowlson

This comment has been minimized.

Copy link
Member

@itowlson itowlson commented Nov 4, 2019

This is super cool! Thank you for letting us know about this @sandipchitale! Is there anything specifically you'd like the core extension to do? Because it looks like your project is working great as an extension that builds on top via the API, and if we implemented this ourselves then it would just suck the oxygen out of your project. But if there are limitations in the core extension API that are making your life harder, or if we can amplify or contribute to your work, let's talk!

Thanks for letting us know about this!

cc @squillace

@technosophos

This comment has been minimized.

Copy link
Member

@technosophos technosophos commented Nov 4, 2019

Do we have a place to post "related extensions"? It might be good to start building up a list of extensions that build on top of the API.

@sandipchitale

This comment has been minimized.

Copy link
Author

@sandipchitale sandipchitale commented Nov 4, 2019

@itowlson I am glad you find the extension useful. I will be happy for it to continue as a separate extension. It could be an example of how to extend your extension via API.

Your API is already good. The only thing I would request is availability of context of custom nodes to be used in the when clause of menu contributions. That way I could show the Find command for FolderNodes only and View file command for FileNodes only. Basically something along the lines of viewItem =~ /vsKubernetes\containerfilenode. Actually I figured this out. I have to set the contextValue for the tree node myself and then use it in the when clause.

BTW I am looking into implementing (time permitting) the dual pane idea for being able to copy files to/from container easily. I guess this is sort of possible using View file command and the saving the Untitled document locally. But the dual pane one will work more like FileZilla or something. It will use VSCode FileSystemProvider backed by -- ls -l executed in the container. And use kubectl cp command to copy files to/from container/local file system.

The extension now supports shelling into Kubernetes nodes using nsenter (on MS Windows only)

I guess you can close this issue.

BTW I have another extension based on your API: https://marketplace.visualstudio.com/items?itemName=sandipchitale.kubernetes-no-load-on-select

@bhack

This comment has been minimized.

Copy link

@bhack bhack commented Nov 7, 2019

I think that having Kubernetes support in vscode remote will be more useful that just browsing POD file.
Please check microsoft/vscode-remote-release#12

@sandipchitale

This comment has been minimized.

Copy link
Author

@sandipchitale sandipchitale commented Nov 7, 2019

@bhack thanks for the reference. I agree that will be more complete solution. My integration was a quick and simple implementation to get browsing going.

In first comment I suggested using FileSystemProvider based on Kubectl command integration via this extension.

@bhack

This comment has been minimized.

Copy link

@bhack bhack commented Nov 7, 2019

Yes the remote extension is closed source so we can just upvote that issue to prioritize It.

@sandipchitale

This comment has been minimized.

Copy link
Author

@sandipchitale sandipchitale commented Nov 27, 2019

For anyone coming here...the above extension supports:

  • shelling into nodes using nsenter
  • exploration of container files, viewing, tailing, kubectl cp from/to container folders and files to local folder and files

BTW this issue can be closed if there are no plans to implement the issue functionality in the Kubernetes extension's code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.