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

Ignore ServFail / NxDomain for search list, e.g. in Kubernetes cluster #99

Closed
roquie opened this issue Apr 30, 2020 · 9 comments
Closed

Comments

@roquie
Copy link

roquie commented Apr 30, 2020

Any requests called with amphp/http-client will use these dns package. Where requests will sent inside kubernetes cluster it fails with following reason:

In Rfc1035StubResolver.php line 193:

  All query attempts failed for {{ADDRESS}}-prod.svc.cluster.l
  ocal: Server returned error code: 3, Server returned error code: 3


In functions.php line 534:

  Multiple errors encountered; use Amp\MultiReasonException::getReasons() to
  retrieve the array of exceptions thrown

Requests from pod to pod inside a same namespace in Kubernetes cluster by service name (kubectl get svc). If using local ip address instead of dns it works. But this workaround is not possible for all cases.

I think this is critical issue because a lot of many users use Kubernetes every day.

PHP: 7.4.5
amphp/amp: v2.4.4
amphp/dns: v1.2.1
amphp/http-client: v4.2.2
OS: Alpine

UV extension installed from pecl.

@roquie
Copy link
Author

roquie commented Apr 30, 2020

#41

@kelunik
Copy link
Member

kelunik commented Apr 30, 2020

I haven't used Kubernetes, yet. How does DNS resolution work there? What's different?

@roquie
Copy link
Author

roquie commented May 8, 2020

Sorry for long answer. On next week I will be again works with amphp/dns and try to run series of tests in cluster. Before this bug I should fix the issue with amphp/postgres because it blocks my work.

@roquie
Copy link
Author

roquie commented Jun 19, 2020

  • 1.2.1 does not work in cluster with global available addresses (tested github.com and api.telegram.org), but 0.9.15 works fine.
  • 0.9.15 also does not work with local domain names in kubernetes cluster
  • 1.1.0 works same as 0.9.15

In all cases gethostbyname returns ip.

UPD:
For 1.2.1 version this hack not help me. #82

/etc/resolv.conf

cat /etc/resolv.conf
nameserver 172.17.0.10
search calcifer-dev.svc.cluster.local svc.cluster.local cluster.local
options ndots:5

I'm trying to find some bugs in PR #89 ...

@kelunik
Copy link
Member

kelunik commented Jun 19, 2020

What's the error message you get for github.com?

@roquie
Copy link
Author

roquie commented Jun 19, 2020

Screenshot 2020-06-19 at 22 37 13

kelunik added a commit that referenced this issue Jun 19, 2020
@kelunik
Copy link
Member

kelunik commented Jun 19, 2020

Please retry with 8cf2ccc / latest dev-master.

@roquie
Copy link
Author

roquie commented Jun 20, 2020

Yes, that works in all cases. Thanks! :)

@roquie roquie closed this as completed Jun 20, 2020
@kelunik kelunik changed the title Supports of Kubernetes cluster Ignore ServFail / NxDomain for search list, e.g. in Kubernetes cluster Jun 20, 2020
@kelunik
Copy link
Member

kelunik commented Jun 20, 2020

Thanks for testing! Tagged as v1.2.2.

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

No branches or pull requests

2 participants