<p>I am deploy coredns(v1.6.7) in my kuberntes cluster(v1.15.2),now the pod's <code>/etc/resolv.conf</code>:</p>

<pre><code> nameserver 10.96.0.10
    search default.svc.cluster.local svc.cluster.local cluster.local
    options ndots:5
</code></pre>

<p>but my codedns's ip is <code>10.96.0.2</code>,how to make it using my cluster's coredns ip? This is the dns config:</p>

<pre><code>dnsPolicy: ClusterFirst
</code></pre>

<blockquote>
  <p>but my codedns's ip is 10.96.0.2,how to make it using my cluster's coredns ip? </p>
</blockquote>

<p>You didn't mention how you start cluster. But I guess your are using kubedns. Deploy coredns didn't mean use it. You will need to configure default kubernetes behavior.</p>

<h2>Solution</h2>

<p>ref: <a href="https://github.com/coredns/deployment/tree/master/kubernetes" rel="nofollow noreferrer">https://github.com/coredns/deployment/tree/master/kubernetes</a></p>

<blockquote>
  <p>CoreDNS can run in place of the standard Kube-DNS in Kubernetes. Using the kubernetes plugin, CoreDNS will read zone data from a Kubernetes cluster. It implements the spec defined for Kubernetes DNS-Based service discovery:</p>
</blockquote>

<p>In the best case scenario, all that's needed to replace Kube-DNS are these commands:</p>

<pre><code>$ ./deploy.sh | kubectl apply -f -
$ kubectl delete --namespace=kube-system deployment kube-dns
</code></pre>
