Open bhack opened 5 years ago
@markomitranic Are you connected with Remote-SSH to the SSH server or is VS Code's UI running on the SSH server?
@chrmarti Connected over Remote-SSH
Filed https://github.com/microsoft/vscode-remote-release/issues/6054 for connecting through a SSH server.
Hi @chrmarti, When I'm trying the "attach visual studio code" option, it opens a new vs code window and connects to the pod, but my source code is still open in the first window. Is there any way to configure local source code path for this option? Maybe I'm missing a step ? Thanks.
@arashnorouzi VS Code is not aware of any mount points inside the pod. Would you expect the existing window to be reused?
When using the "Attach Visual Studio Code" on a Pod it executes:
kubectl -n myns exec -it my-deployment-94bb57f74-xlkx7 -- /bin/sh -c VSCODE_REMOTE_CONTAINERS_SESSION='UUID' /bin/sh
This seems wrong as this command terminates immediately, everything after -c
should be quoted. The follwowing command would be correct:
kubectl -n myns exec -it my-deployment-94bb57f74-xlkx7 -- /bin/sh -c "VSCODE_REMOTE_CONTAINERS_SESSION='UUID' /bin/sh"
Can I configure that or is this a bug?
@tobru The quoting is only needed when running the command from a shell, but we spawn the process directly, passing the parameters as an array. The part you suggest to quote is passed as a single entry in that array.
Are you seeing the command terminate immediately?
I have the same problem. I followed this procedure (https://code.visualstudio.com/docs/remote/attach-container#_attach-to-a-container-in-a-kubernetes-cluster) and I get the following error. I am cluster admin. vs-error.txt
I'm chasing some similar issues as @tobru mentions.
I discovered these issues while debugging "Attach to Visual Studio".
Some aspect(s) of VSCode cause kubectl
subprocesses to give no stderr/stdout
, and some subcommands/args to fail entirely, in a variety of settings:
kubectl
directly.
spawn('kubectl', ['get', 'pod', '-o', 'json'])
kubectl ...
in a bash
subprocess.
spawn('bash', ['-c', 'kubectl get pod'])
kubectl ...
subprocess inside a Node process inside the bash
subprocess backing the VSCode terminal.
In some other settings, kubectl
and VSCode get along perfectly well:
bash
terminal
kubectl ... | tee /dev/null
in a bash
subprocess.
execOnArgs
Tests" in 'Detailed Debugging of "Attach to Visual Studio"'kubectl ... | tee /dev/null
subprocess inside a Node process inside the bash
subprocess backing the VSCode terminal.
The success and failure characteristics are identical across all these different settings. The behavior in the minimal case screencast is identical to the behavior leading to errors while running "Attach to Visual Code".
This is not the error discussed above, but is closely related. This error arises when something in VSCode calls vscode.commands.executeCommand(..., uri, ...)
where uri
starts with k8s-container
. When that URI is interpreted by remote-containers, kubectl exec ...
is launched as a subprocess to interact with the container, and fails. This same failure arises even when the errors discussed above are resolved or sidestepped.
This is, I believe, the specific error @tobru mentioned.
kubectl exec ...
on the desired pod.@kubernetes/client-node
instead of constructing commands as strings/subprocesses
@kubernetes/client-node
's featureset instead of directly relating to the host kubectl
's featureset@kubernetes/client-node
and cluster API (same risk as host kubectl
, but still another update to manage)kubectl
subprocesses, and fix that directlyOn Windows 10. I've been trying this attach method from the context menu but it fails to establish a connection. I get a websocket 1006 error. I'm able to pull up the remote terminal via ssh from the kubernetes plugin however. But attach doesn't work at all.
If I switch to MacOs it works perfectly.
Support for containers running in kubernetes (pod, deployment etc..)