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

VSCode remote container development #3960

Closed
pierreyves-lebrun opened this issue Apr 16, 2020 · 8 comments
Closed

VSCode remote container development #3960

pierreyves-lebrun opened this issue Apr 16, 2020 · 8 comments
Labels
kind/question User question

Comments

@pierreyves-lebrun
Copy link

pierreyves-lebrun commented Apr 16, 2020

JIs there a straightforward way to develop in a remote container from VSCode?

Afaik, the only way to achieve this is to manually attach to one of the running containers Skaffold deployed on the K8s cluster.

This can be tedious in the case of a remote cluster composed of many nodes. Every time Skaffold rebuilds a container, devs need to find which K8s node has been used and reattach to it.

A local or remote Minikube setup probably doesn’t have that issue but I’d like to know if a better VSCode remote container development integration is possible.

https://code.visualstudio.com/docs/remote/containers

@tstromberg tstromberg added the kind/question User question label Apr 20, 2020
@tstromberg
Copy link
Contributor

Can you clarify on exactly what you are looking for?

I don't understand the "manually attach" part at all. There should be no manual steps involved with Skaffold developing against a remote cluster. Is this in reference to debugging?

FWIW, https://cloud.google.com/code is a VSCode plug-in that uses Skaffold for Kubernetes development, and supports debugging.

@pierreyves-lebrun
Copy link
Author

Can you clarify on exactly what you are looking for?

Skaffold supports debugging but not development in Kubernetes containers.

Developers still have to locally install all dev dependencies for their IDE to work, which is something you shouldn’t have to do.

Tools like Okteto solve this by allowing people to dev directly into containers:
https://okteto.com/docs/reference/faqs/index.html#how-is-okteto-different-from-other-tools-like-skaffold
https://okteto.com/blog/vs-code-remote-development-in-kubernetes/

@briandealwis
Copy link
Member

@pierreyves-lebrun Skaffold does support syncing files to the remote containers. Does VS Code remote containers support developing multiple containers in parallel?

@pierreyves-lebrun
Copy link
Author

@pierreyves-lebrun Skaffold does support syncing files to the remote containers.

Yes I know, but syncing files to a remote container is different than developing in it.
Ideally I don’t want to install any dependency on my laptop for working on a project, I just want to plug my IDE into the remote container as it embeds all my project dependencies.

This is what VSCode “dev in remote container” feature is about, using a repeatable and easily deployable environment (a container) for development.

Does VS Code remote containers support developing multiple containers in parallel?

Yes and no, if you’ve got 2 containers for let’s say frontend and backend then you’d have to have two VSCode windows open and remote into the frontend and backend container from each window.

@tstromberg
Copy link
Contributor

@pierreyves-lebrun - I believe the answer here is likely just running skaffold in a remote interactive container, and connecting VS Code to it.

I'm not a pro VS code user, so I'm exactly sure of how to do the latter, but you can probably cobble something together using SSH.

@pierreyves-lebrun
Copy link
Author

@tstromberg I am not sure what you mean by “running Skaffold in a remote container”, could elaborate please?

I am happy to run Skaffold locally, that isn’t my issue. What I want is to develop in a container holding all my development environment, that way I don’t have to locally install any dependency.

That container happens to be deployed by Skaffold, so I could indeed manually attach VSCode to it, but Skaffold should be able to do that automatically.

I thought this was a fairly standard practice in 2020 but it seems not to be the case.

May I ask how Google developers work? In the case of a node project, do you end up installing all modules on your local machine?

@nkubala
Copy link
Contributor

nkubala commented Jul 9, 2020

i think i'm having a bit of trouble understanding how skaffold fits into the picture here. if skaffold is deploying the container that has your development environment in it (that you're presumably connecting to via SSH or remote VSCode), then are you also using skaffold inside of that deployed container as well? it seems to me like you'd want to build the development image (with skaffold inside of it) once, deploy it, then attach and run skaffold "locally" (inside of the container) while you iterate on your app. maybe i'm misunderstanding the use case though?

i can only speak for our team, but for our development we configure our environments locally to our machines. maybe we're living in the past, but it's what we do right now 🤷

@w121211
Copy link

w121211 commented Mar 11, 2021

Similar case here, I prefer to develop inside the container so I can assure my development env does not pollute and be sharable with others.
VSCode has the feature to attach to the container (similar to ssh a remote server) and use the container as develop environment. However this strategy seems not workable because skaffold does not provide a 2-way file sync. In other words, although I can edit source file inside the container, the edited file cannot sync back to my local machine, and the edited file will be removed if the pod get restarted.
I personally think a 2-way file sync can actually solve this problem. #2492

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

No branches or pull requests

5 participants