devpod icon indicating copy to clipboard operation
devpod copied to clipboard

Devpod on windows using Kubernetes provider fails on kubectl cp step

Open fnschroeder opened this issue 1 year ago • 1 comments

What happened? On a clean windows 2022 server install devpod is running. Setting up a Kubernetes provider also worked without issues. However, upon provisioning a new pod, the following error is shown upon creation (devpod up command):

14:38:34 info Waiting, since pod 'devpod-base-devpod-image-default-650f4' is waiting to start:  (ContainerCreating)
14:38:35 debug Run command: kubectl --namespace devpod get pod devpod-base-devpod-image-default-650f4 --ignore-not-found -o json
14:38:36 debug Run command: kubectl --namespace devpod get pod devpod-base-devpod-image-default-650f4 --ignore-not-found -o json
14:38:37 debug Run command: kubectl --namespace devpod get pod devpod-base-devpod-image-default-650f4 --ignore-not-found -o json
14:38:37 info Copy C:\Users\Administrator\Desktop\devpod\base-devpod-image into DevContainer /workspaces/base-devpod-image
14:38:38 debug Run command: kubectl --namespace devpod cp -c devpod C:\Users\Administrator\Desktop\devpod\base-devpod-image/. devpod-base-devpod-image-default-650f4:/workspaces/base-devpod-image
14:38:38 info exit status 1
14:38:38 info copy to devcontainer
14:38:38 info github.com/loft-sh/devpod/pkg/driver/kubernetes.(*kubernetesDriver).runContainer
14:38:38 info   D:/a/devpod/devpod/pkg/driver/kubernetes/run.go:238
14:38:38 info github.com/loft-sh/devpod/pkg/driver/kubernetes.(*kubernetesDriver).RunDevContainer
14:38:38 debug Done executing up command
14:38:38 debug Done creating devcontainer
14:38:38 info   D:/a/devpod/devpod/pkg/driver/kubernetes/run.go:77
14:38:39 info github.com/loft-sh/devpod/pkg/devcontainer.(*Runner).runSingleContainer
14:38:39 fatal executing agent command: exit status 1

A second devpod up command brings the container up but doesn't bring the files, due to the bug. I then attempted to forcefully run the failed command for a better error message: kubectl --namespace devpod cp -c devpod C:\Users\Administrator\Desktop\devpod\base-devpod-image/. devpod-base-devpod-image-default-650f4:/workspaces/base-devpod-image

The error is then: error: one of src or dest must be a local file specification

What did you expect to happen instead? The devpod container would start and files copied as expected

How can we reproduce the bug? (as minimally and precisely as possible) You can use a kubernetes environment (any) and run a devpod up . on any base container such as ubuntu.

Example devcontainer.json: {"image":"mcr.microsoft.com/devcontainers/base:ubuntu"}

Local Environment:

  • DevPod Version: v0.2.1
  • Operating System: windows
  • ARCH of the OS: AMD64

DevPod Provider:

  • Kubernetes Provider:
Client Version: version.Info{Major:"1", Minor:"27", GitVersion:"v1.27.3", GitCommit:"25b4e43193bcda6c7328a6d147b1fb73a33f1598", GitTreeState:"clean", BuildDate:"2023-06-14T09:53:42Z", GoVersion:"go1.20.5", Compiler:"gc", Platform:"windows/amd64"}
Kustomize Version: v5.0.1
Server Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.6+5658434", GitCommit:"eddac29feb4bb46b99fb570999324e582d761a66", GitTreeState:"clean", BuildDate:"2022-11-09T10:31:39Z", GoVersion:"go1.18.7", Compiler:"gc", Platform:"linux/amd64"}

Anything else we need to know? This is a known issue on the kubernetes front when doing kubectl cp and there are paths with the Colon character, so they should fix on their end, but there are workarounds suggested, see here for an example: https://github.com/kubernetes/kubernetes/issues/110120#issuecomment-1139144611 See if you also see this issue and if the workaround makes sense, totally ok if it does not, just trying to help the best I can. Thanks for all you do!

Best Regards, Filipe

fnschroeder avatar Jul 11 '23 15:07 fnschroeder

@fnschroeder thanks for creating this issue! Seems like your proposed workaround is missing in the issue, could you add that?

FabianKramm avatar Jul 11 '23 16:07 FabianKramm