-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
/etc/resolv.conf nameserver order varies when starting a container with multiple networks. #14262
Comments
Using the |
I will see about trying that out. It seems like I need to recreate all containers and networks for that. So it will take a just a bit. |
The random order is by design since the info is stored in a map. In theory we could make it deterministic by sorting the nameservers before adding them. |
Even then, I don't know if it's worth ensuring sorting during all the operations that effect resolv.con (I'm thinking of network connect/disconnect - do we sort again when adding? |
I don't know. The current idea is to always add the new server in front on network connect. |
I rebuilt my test infrastructure to use netavark. (Full OS reinstall and replaced all containers)
I reran my dns resolution tests and still had the same results. This time I found some additional info. Since I rebuilt my test infrastructure I do not know if this issue happens with the CNI backend also. I looked deeper into the issue and found that with Setup for the tests:
FQDN test
FQDN result
You will notice that the right network has no response. SHORTNAME test
SHORTNAME result
Here both networks responded was described above. (Ie same result from all networks) Other notes:
Questions:
|
FQDN behavior definitely seems like a bug, please file a fresh issue for it. |
In researching containers/aardvark-dns#403 I found that docker only provides one name server for multiple networks to all containers so server order is not a problem there. Though docker seems to not allow creating a container with multiple networks from the start. |
A friendly reminder that this issue had no activity for 30 days. |
A friendly reminder that this issue had no activity for 30 days. |
We could sort the nameservers by name to make it deterministic. |
SGTM |
aren't this and containers/aardvark-dns#403 the same bug? should this be closed in favor of it? In fact this issue was first reported early 2021 here: #9492. So this one is the same too (but this is closed) |
I do not see these bugs as being the same. At the moment this bug just makes the other bug randomly visible. I believe this bug would still affect anyone using CNI plugins, even if the other was resolved. This is presuming that ultimately podman, not netavark or CNI plugins generate the contents of If CNI plugins are dropped, as planned, and this aspect is not addressed you would still be generating a randomly ordered |
I am closing this as wontfix. While with with netavark the order is still not deterministic it should behave correctly as aardvark-dns can resolve names for all networks unlike the old dnsname plugin. |
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
When starting a container with two networks attached the nameserver order inside the container
/etc/resolv.conf
file seems to be random. Unfortunately this causes some name resolution issues. I was expecting the order to be the same as what the--network
argument received.Specifically I have traefik -> nextcloud -> postgres
traefik
)traefik
andnextcloud
networksnextcloud
networkNextcloud fails to resolve
nextcloud-postgres.dns.podman
when thetraefik
name server is listed first in/etc/resolv.conf
Simpler steps are provided to reproduce the issue.
Steps to reproduce the issue:
watch -d -n 1 podman run --rm -ti --network nextcloud,traefik fedora cat /etc/resolv.conf
Describe the results you received:
I see name servers for the two container networks switch places while my host nameserver always comes in last.
Describe the results you expected:
I expected the
nextcloud
network nameserver to be listed first, followed by thetraefik
network nameserver followed by the host nameserver.Additional information you deem important (e.g. issue happens only occasionally):
Output of
podman version
:Output of
podman info --debug
:Package info (e.g. output of
rpm -q podman
orapt list podman
):Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/main/troubleshooting.md)
Yes
Additional environment details (AWS, VirtualBox, physical, etc.):
running in a libvirt vm.
Edit: fixed typo: postgres container uses the
nextcloud
network nottraefik
The text was updated successfully, but these errors were encountered: