kubernetes / minikube

Run Kubernetes locally
https://minikube.sigs.k8s.io/
Apache License 2.0
28.75k stars 4.81k forks source link

Unable to Pull Images Through Proxy under WSL Ubuntu #19037

Open CallisteH opened 3 weeks ago

CallisteH commented 3 weeks ago

What Happened?

I'm running Minikube under a proxy on my WSL Ubuntu (running under Windows 11).

First of all, my Docker daemon works correctly. I set the proxy in /etc/docker/daemon.json, and docker pull commands work without issues.

Secondly, my Minikube is configured to use Docker as the driver.

Now, I start minikube with these commands :

$ export NO_PROXY=localhost,127.0.0.1,10.96.0.0/12,192.168.59.0/24,192.168.49.0/24,192.168.39.0/24
$ export HTTPS_PROXY=http://127.0.0.1:9000
$ export HTTP_PROXY=http://127.0.0.1:9000

$ minikube start --docker-env HTTPS_PROXY=http://127.0.0.1:9000 --docker-env HTTP_PROXY=http://127.0.0.1:9000 --docker-env NO_PROXY=$NO_PROXY

However, when I try to pull an image, such as nginx, I encounter the following error:

$ kubectl run nginx --image=nginx --image-pull-policy=Always

Warning  Failed          69s (x4 over 2m42s)    kubelet            Failed to pull image "nginx": Error response from daemon: Get "https://registry-1.docker.io/v2/": proxyconnect tcp: dial tcp 127.0.0.1:9000: connect: connection refused

It seems that Minikube correctly uses the proxy at 127.0.0.1:9000. However, unlike Docker, I get a connection refused error for this proxy.

Attach the log file

logs.txt

Operating System

Ubuntu - WSL

Driver

Docker

T-Lakshmi commented 3 weeks ago

/kind support

T-Lakshmi commented 3 weeks ago

Similar issue reported in #13897.

@CallisteH, check 13897 comment may help you to resolve the issue.

CallisteH commented 3 weeks ago

Thank you @T-Lakshmi for your response, which resolved the initial part of my issue. The "ignored proxy" message no longer appears after running minikube start. However, I am now encountering a new problem:

  Warning  Failed          23s                    kubelet            Failed to pull image "nginx": Error response from daemon: Get "https://registry-1.docker.io/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

As mentioned in the GitHub issue comment, it's possible that the 127.0.0.1 address within the Minikube environment does not correspond to the same address on the WSL host.