vscode-kubernetes-tools: Missing "Attach Visual Studio Code" item in VS Code Kubernetes Pod right-click menu on Remote SSH instances
In the docs here https://code.visualstudio.com/docs/remote/attach-container#_attach-to-a-container-in-a-kubernetes-cluster there is described, that Pod right-click menu must contain an “Attach Visual Studio Code” item to launch VS Code inside that container.
But it is missing for me, if I try to do this from VS Code Remote SHH instance, here is the screenshot:

Other functions like Terminal, Port Forward, etc - exist and works well, kubectl in console works well too.
What can cause this problem with missing “Attach to Kubernetes container” feature and how to fix this? Can I give any additional debug information to understand the source of this issue?
Extensions versions: Kubernetes: v1.3.4 Remote - Containers: v0.209.6
VS Code Version: 1.63.2 Commit: 899d46d82c4c95423fb7e10e68eba52050e30ba3 Date: 2021-12-15T09:39:46.686Z Electron: 13.5.2 Chromium: 91.0.4472.164 Node.js: 14.16.0 V8: 9.1.269.39-electron.0 OS: Linux x64 5.13.0-22-generic
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 17
- Comments: 16
Installing “Dev Containers” extension solved the problem for me.
I was facing this issue on Ubuntu 20.04 but installing the “remote containers” extension solved this!
Same issue.
And update for this issue?
can confirm, this solved the issue for me as well.
On my local system it works too, it’s broken only when I try to attach to K8s containers from the VS Code Remote SSH instance.
@MurzNN did you find any fix for this?
“Attach Visual Studio Code” is not, I think, defined by the Kubernetes extension - it comes from the Remote extension itself. Looks like the Remote extension is meant to be working with our pod tree UI but isn’t at the moment - I don’t think we’ve changed anything, though, not sure if they have.
@squillace Could you reach out to the Remote extension folks please and ask them to review this issue? Thanks!
@itowlson Thanks for the information! I’ve found seems similar issue in Remote Containers extension https://github.com/microsoft/vscode-remote-release/issues/7108 and it’s already have a fix! 🎉 but it doesn’t work for me.
And some more maybe related issues: https://github.com/microsoft/vscode-remote-release/issues/6054 https://github.com/microsoft/vscode-remote-release/issues/5849 and maybe https://github.com/microsoft/vscode/issues/111238
Seems this happens when I try to connect in already remote VS Code instance, so I connected via SSH server to remove server, which has a kube-config.
If I use local VS Code instance - the “Attach Visual Studio Code” menu item exists!
Is there a limitation with attaching to k8s containers, using already remote VS Code instance?
The interesting thing, that I see the “Attach” menu item on same VS Code Remote SSH instance on remote server using “Docker” extension:
And using “Remote - Containers” - too:

So seems this is not a limitation of VS Code itself, but some missing functionality in Kubernetes extension?
By the way, I encountered same problem in Docker extension for VS code, the "attach visual studio code "option was also not found, and installing the “Dev Containers” solved this problem!
@pk1996 Are you sure that you’re connecting to the remote container from the remote SSH host, not from local VS Code instance? For local instance it works for me too, but doesn’t work when I connect to a remove host via SSH, and then from that instance - connect to Kubernetes Pod.
I have “remote containers” installed, but still have no “Attach” menu item.
Also my K8s uses not the
Docker, butcontainerd, so maybe this is the source of the missing “Attach” option?Versions: Remote - Containers version: v0.241.3 Remote - SSH version: v0.84.0 VS Code Version: 1.69.2 Commit: 3b889b090b5ad5793f524b5d1d39fda662b96a2a Date: 2022-07-18T16:14:10.636Z Electron: 18.3.5 Chromium: 100.0.4896.160 Node.js: 16.13.2 V8: 10.0.139.17-electron.0 OS: Linux x64 5.15.0-25-generic snap