GoogleContainerTools / skaffold

Easy and Repeatable Kubernetes Development
https://skaffold.dev/
Apache License 2.0
15k stars 1.62k forks source link

Issue with Docker WSL2 and Skaffold v2.0.0 #8006

Open kwsorensen opened 1 year ago

kwsorensen commented 1 year ago

Expected behavior

Getting started tutorial to work correctlt.

Actual behavior

Getting a failure on skaffold dev:

Listing files to watch...
 - skaffold-example
listing files: parsing ONBUILD instructions: retrieving image "golang:1.18": Get "https://index.docker.io/v2/": dial tcp: lookup index.docker.io: i/o timeout

Information

apiVersion: skaffold/v3
kind: Config
build:
  artifacts:
  - image: skaffold-example
manifests:
  rawYaml:
  - k8s-pod.yaml

Steps to reproduce the behavior

WSL 2 environment setup /w Docker:

#docker version
Client:
 Version:           20.10.12
 API version:       1.41
 Go version:        go1.16.2
 Git commit:        20.10.12-0ubuntu2~20.04.1
 Built:             Wed Apr  6 02:14:38 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Desktop
 Engine:
  Version:          20.10.20
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.18.7
  Git commit:       03df974
  Built:            Tue Oct 18 18:18:35 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.8
  GitCommit:        9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
  1. https://github.com/GoogleContainerTools/skaffold/tree/main/examples/getting-started
  2. skaffold dev
  3. skaffold dev -vdebug logs

DEBU[0000] skaffold API not starting as it's not requested subtask=-1 task=DevLoop INFO[0000] Skaffold &{Version:v2.0.0 ConfigVersion:skaffold/v3 GitVersion: GitCommit:6c50b2a6b1f3293918db05decacb175537834613 BuildDate:2022-10-20T15:21:30Z GoVersion:go1.19.1 Compiler:gc Platform:linux/amd64 User:} subtask=-1 task=DevLoop INFO[0000] Loaded Skaffold defaults from "/home/kyle/.skaffold/config" subtask=-1 task=DevLoop DEBU[0000] parsed 1 configs from configuration file /home/kyle/src/skaffold/examples/getting-started/skaffold.yaml subtask=-1 task=DevLoop DEBU[0000] Defaulting build type to local build subtask=-1 task=DevLoop DEBU[0000] Found raw k8s manifests without cloud run deploy, adding kubectl deployer subtask=-1 task=DevLoop INFO[0000] map entry found when executing locate for &{skaffold-example . {0xc000c36160 } [] {[] []} []} of type latest.Artifact and pointer: 824635591104 subtask=-1 task=DevLoop INFO[0000] Using kubectl context: docker-desktop subtask=-1 task=DevLoop DEBU[0000] getting client config for kubeContext: docker-desktop subtask=-1 task=DevLoop DEBU[0000] getting client config for kubeContext: docker-desktop subtask=-1 task=DevLoop DEBU[0000] Running command: [minikube version --output=json] subtask=-1 task=DevLoop DEBU[0000] setting Docker user agent to skaffold-v2.0.0 subtask=-1 task=DevLoop INFO[0000] manifests hydration will take place in /home/kyle/src/skaffold/examples/getting-started/.kpt-pipeline subtask=-1 task=DevLoop DEBU[0000] Running command: [kubectl config view --minify -o jsonpath='{..namespace}'] subtask=-1 task=DevLoop DEBU[0000] Command output: [''] subtask=-1 task=DevLoop DEBU[0000] Running command: [kubectl config view --minify -o jsonpath='{..namespace}'] subtask=-1 task=DevLoop DEBU[0000] Command output: [''] subtask=-1 task=DevLoop DEBU[0000] Running command: [kubectl config view --minify -o jsonpath='{..namespace}'] subtask=-1 task=DevLoop DEBU[0000] Command output: [''] subtask=-1 task=DevLoop DEBU[0000] Running command: [kubectl config view --minify -o jsonpath='{..namespace}'] subtask=-1 task=DevLoop DEBU[0000] Command output: [''] subtask=-1 task=DevLoop DEBU[0000] Running command: [kubectl config view --minify -o jsonpath='{..namespace}'] subtask=-1 task=DevLoop DEBU[0000] Command output: [''] subtask=-1 task=DevLoop DEBU[0000] Running command: [kubectl config view --minify -o jsonpath='{..namespace}'] subtask=-1 task=DevLoop DEBU[0000] Command output: [''] subtask=-1 task=DevLoop DEBU[0000] Running command: [kubectl config view --minify -o jsonpath='{..namespace}'] subtask=-1 task=DevLoop DEBU[0000] Command output: [''] subtask=-1 task=DevLoop DEBU[0000] CLI platforms provided: "" subtask=-1 task=DevLoop DEBU[0000] getting client config for kubeContext: docker-desktop subtask=-1 task=DevLoop DEBU[0000] platforms detected from active kubernetes cluster nodes: "linux/amd64" subtask=-1 task=DevLoop DEBU[0000] platforms selected for artifact "skaffold-example": "linux/amd64" subtask=-1 task=DevLoop DEBU[0000] Using builder: local subtask=-1 task=DevLoop DEBU[0000] push value not present in NewBuilder, defaulting to false because cluster.PushImages is false subtask=-1 task=DevLoop INFO[0000] build concurrency first set to 1 parsed from local.Builder[0] subtask=-1 task=DevLoop INFO[0000] final build concurrency value is 1 subtask=-1 task=DevLoop Listing files to watch...

aaron-prindle commented 1 year ago

From the logs posted here, it seems that the WSL2 cannot access the internet - can't find https://storage.googleapis.com/skaffold/releases/latest/VERSION or https://index.docker.io/v2. The error messages from the debug logs show that during the docker build, docker was not able to pull down the golang:1.18 image from the Docker registry. Can you verify that the WSL2 has access to the internet and can pull images using docker pull? If I understand correctly, this is not working because the environment cannot access the internet to pull down deps one of your images needs

kwsorensen commented 1 year ago

docker pull golang:1.18 works inside wsl2. Posting my /etc/resolv.conf. After that I get the error:

listing files: parsing ONBUILD instructions: retrieving image "alpine:3": Get "https://index.docker.io/v2/": dial tcp: lookup index.docker.io: i/o timeout

after doing a docker pull alpine:3 skaffold dev appears to work. Not sure why only networking inside of skaffold dev fails. I am posting my resolv.conf for informational purposes.

# /etc/resolv.conf
nameserver 8.8.8.8
aaron-prindle commented 1 year ago

Glad you were able to get things working by manually pulling images. I will leave this open to see if anyone else encounters this, not sure currently why docker would be able to pull but skaffold couldn't

aaron-prindle commented 1 year ago

Going to close this for now as no other users seem to have encountered this, feel free to comment and I will re-open this you think this is an issue with Skaffold or if anyone else encounters this

andresrguzman commented 1 year ago

Hi @aaron-prindle , currently facing the same issue with the same setup as @kwsorensen. The solution mentioned above seems to fix it, i.e. pull the images and then run the commands, in my case I used the skaffold build -vdebug command with the following skaffold.yaml

apiVersion: skaffold/v4beta1
kind: Config
metadata:
  name: hello-world-go
build:
  tagPolicy:
    gitCommit:
      ignoreChanges: true
  artifacts:
    - image: my-example/hello-world-go
 deploy:
    ...
gsquared94 commented 1 year ago

/triage-action