Dolphin
Dolphin

Reputation: 38601

pods not get the correct coredns ip address

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

 nameserver 10.96.0.10
    search default.svc.cluster.local svc.cluster.local cluster.local
    options ndots:5

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

dnsPolicy: ClusterFirst

Upvotes: 2

Views: 1700

Answers (1)

RammusXu
RammusXu

Reputation: 1260

but my codedns's ip is 10.96.0.2,how to make it using my cluster's coredns ip?

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.

Solution

ref: https://github.com/coredns/deployment/tree/master/kubernetes

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:

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

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

Upvotes: 3

Related Questions