curl / curl-docker

official docker image for curl
https://curl.se
Other
168 stars 67 forks source link

Dns resolution problem with Alpine and Kubernetes #65

Closed TLmaK0 closed 2 years ago

TLmaK0 commented 2 years ago

After version 7.77 curl is not able to resolve hosts:

kubectl run --restart Never --image curlimages/curl:7.80.0 curl -- domain.com kubectl logs curl

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (6) Could not resolve host: domain.com

kubectl delete pod curl kubectl run --restart Never --image curlimages/curl:7.77.0 curl -- domain.com kubectl logs curl

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx</center>
</body>
</html>
100   162  100   162    0     0    295      0 --:--:-- --:--:-- --:--:--   295

I think this is due to problems with Alpine and Kubernetes dns reported, like this: https://www.openwall.com/lists/musl/2018/03/30/7

xquery commented 2 years ago

it seems like you are resolving to a 301 - to instruct curl to follow redirects you need to provide the -L option

TLmaK0 commented 2 years ago

@xquery I think you didn't understand correctly the problem. If you look at the first request you will see a curl: (6) Could not resolve host: domain.com which is not correct, but if you do the same with other curl version it works as expected.

xquery commented 2 years ago

I think I understand your problem - was reading things wrong way around ;)

doing

docker run curlimages/curl:7.77.0 -v -- domain.com

vs

docker run curlimages/curl:7.81.0 -v -- domain.com

seeing same output, trying to repro in Kubernetes

TLmaK0 commented 2 years ago

Thanks @xquery ;)

It could be realated to https://stackoverflow.com/questions/65181012/does-alpine-have-known-dns-issue-within-kubernetes

djhoese commented 2 years ago

It seems this was closed before the problem was identified. Are there any suggestions for what someone who wants to use these images should do when running on a Kubernetes cluster and getting these DNS "Could not resolve" errors?

TLmaK0 commented 2 years ago

@djhoese the only way I found is to downgrade to curl 7.77