-
Notifications
You must be signed in to change notification settings - Fork 2k
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
CNI DNS config ignored for Docker task #11102
Comments
Hi @radriaanse and thanks for raising this issue. I have reproduced this locally and spent a fair time locally investigating this but have unable to so far find a solution or the exact cause of the issue. It does, however, initially seem to be a problem with the CNI plugins repository rather than Nomad. Issue #431 seems to roughly describe a similar problem, however, there has been no responses from containernetworking members. Testing outside of Nomad to check whether we are manipulating state we shouldn't be, I used cnitool to allocate a network to a network namespace. I firstly create a network namespace using
The cnitool add command
When I exec into the network namespace to check the
I also tested by adding a temporary custom resolv.conf file to disk and referencing that within the
Apologies I am unable to provide a workaround or propose a solution at this time. I will keep the issue open; if we have time to continue the investigation we will do so and respond with any updates. |
Thanks @jrasell for looking into it, I didn't think about using something like cnitool to verify the behavior outside of Nomad. I'll also try to dig into this further and update here! |
Good time of a day, colleges. I have same issue and run some debugs and maybe find out point there dns config is missing. After all, I can't confirm ResolvConfPath file's correct creation via CNI It seems nomad should create resolv.conf file, like it does using network->dns stanza because i failed to find any real dns configuration in cni plugins. Also i failed to find any dns configuration mechanics in cni docs [1] https://unix.stackexchange.com/questions/443898/separate-dns-configuration-in-each-network-namespace |
Can confirm a similar behavior with {
"cniVersion": "0.4.0",
"name": "vpc",
"plugins": [
{
"type": "ipvlan",
"master": "eth1",
"mode": "l3s",
"ipam": {
"type": "host-local",
"resolvConf": "/opt/cni/run/vpc-resolv.conf",
"dataDir": "/var/run/cni",
"ranges": [
[
{
"subnet": "172.16.6.96/28"
}
],
[
{
"subnet": "2a05:d014:d9e:c300:4f2:0:0:0/80"
}
]
],
"routes": [
{
"dst": "::/0"
},
{
"dst": "0.0.0.0/0"
}
]
}
},
{
"type": "portmap",
"capabilities": {
"portMappings": true
},
"snat": true
},
{
"type": "firewall",
"backend": "iptables"
}
]
}
$ nomad alloc exec -i -t -task redis 077c1c44 /bin/bash
root@8e87a7b70408:/data# cat /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4 |
CNI plugins may set DNS configuration, but this isn't threaded through to the task configuration so that we can write it to the `/etc/resolv.conf` file as needed. Add the `AllocNetworkStatus` to the alloc hook resources so they're accessible from the taskrunner, which will prepend the DNS entries to any entries provided by the user. Fixes: #11102
CNI plugins may set DNS configuration, but this isn't threaded through to the task configuration so that we can write it to the `/etc/resolv.conf` file as needed. Add the `AllocNetworkStatus` to the alloc hook resources so they're accessible from the taskrunner. Any DNS entries provided by the user will override these values. Fixes: #11102
CNI plugins may set DNS configuration, but this isn't threaded through to the task configuration so that we can write it to the `/etc/resolv.conf` file as needed. Add the `AllocNetworkStatus` to the alloc hook resources so they're accessible from the taskrunner. Any DNS entries provided by the user will override these values. Fixes: #11102
CNI plugins may set DNS configuration, but this isn't threaded through to the task configuration so that we can write it to the `/etc/resolv.conf` file as needed. Add the `AllocNetworkStatus` to the alloc hook resources so they're accessible from the taskrunner. Any DNS entries provided by the user will override these values. Fixes: #11102
…o release/1.5.x (#20012) CNI plugins may set DNS configuration, but this isn't threaded through to the task configuration so that we can write it to the `/etc/resolv.conf` file as needed. Add the `AllocNetworkStatus` to the alloc hook resources so they're accessible from the taskrunner. Any DNS entries provided by the user will override these values. Fixes: #11102 Co-authored-by: Tim Gross <tgross@hashicorp.com>
…o release/1.6.x (#20013) CNI plugins may set DNS configuration, but this isn't threaded through to the task configuration so that we can write it to the `/etc/resolv.conf` file as needed. Add the `AllocNetworkStatus` to the alloc hook resources so they're accessible from the taskrunner. Any DNS entries provided by the user will override these values. Fixes: #11102 Co-authored-by: Tim Gross <tgross@hashicorp.com>
I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues. |
Nomad version
Nomad v1.1.2 (60638a0)
Operating system and Environment details
CentOS Stream release 8
Docker version 20.10.7, build f0df350
Issue
When setting up name servers inside a CNI network configuration, for example using the bridge plugin, Nomad seems to not take into account the name servers in the context of starting a Docker container.
Although the upstream
bridge
plugin at a first glance doesn't seem to support setting DNS this way (but rather should do so via an ipam plugin; which isn't implemented) it does work as can be seen by the debug log that Nomad produces on receiving the CNI config.I've marked it as a bug since looking at the source it does actually parse this information but then apparently gets lost somewhere in the process.
Reproduction steps
Setup Nomad client CNI:
And configure a CNI network:
Expected Result
The name servers defined in the CNI conflist are added into the resolv.conf
Actual Result
Docker adds the default/fallback name servers to the resolv.conf
Job file (if appropriate)
Nomad Server logs (if appropriate)
The text was updated successfully, but these errors were encountered: