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

forward . /etc/resolv.conf not work sometimes when use local dns #3147

Closed
wwgfhf opened this issue Aug 19, 2019 · 3 comments
Closed

forward . /etc/resolv.conf not work sometimes when use local dns #3147

wwgfhf opened this issue Aug 19, 2019 · 3 comments

Comments

@wwgfhf
Copy link
Contributor

wwgfhf commented Aug 19, 2019

I use coredns 1.5.0 in k8s 1.14.3 , the config of coredns is

.:53 {
        errors
        health
        ready
        kubernetes cluster.local in-addr.arpa ip6.arpa {
          pods insecure
          upstream /etc/resolv.conf
          fallthrough in-addr.arpa ip6.arpa
        }
        prometheus :9153
        forward . /etc/resolv.conf {
          prefer_udp
        }
        cache 30
        loop
        reload
        loadbalance
    }

i write my local dns in /etc/resolv.conf, but it not work sometimes in pod.
But when i change the /etc/resolv.conf to local dns address

forward . 10.110.18.115

it worked always

@chrisohaver
Copy link
Member

Can you show us what is in /etc/resolv.conf?

Does it work more reliably if you remove prefer_udp? #3110

@wwgfhf
Copy link
Contributor Author

wwgfhf commented Aug 20, 2019

@chrisohaver Thanks for your reply, this is my /etc/resolv.conf

nameserver 10.110.18.115
nameserver 114.114.114.114

And it seeams same as before when remove prefer_udp.

@chrisohaver
Copy link
Member

You have two nameservers in /etc/resolv.conf, which is why you see the behavior difference when you specify just one of them. "114.114.114.114" presumably not working.

By default the forward plugin uses the "random" policy, see https://github.com/coredns/coredns/blob/master/plugin/forward/README.md. You can use "sequential" instead so the "10.110.18.115" server is always tried first. e.g.

        forward . /etc/resolv.conf {
          policy sequential
          prefer_udp
        }

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

No branches or pull requests

3 participants