K8S CoreDNS deployment fails, problem analysis

1. The basic cluster deployment pod of inquiry k8s

The following diagram, we can see the container coredns and dnsutils are deployed successfully, but because of name resolution problems, leading to coredns and dnsutils container constantly reboot (check heath reasons, can not request succeeds, it is kubelet restart the pod)

Command is as follows:

root >> kubectl get all --all-namespaces -o wide

root >> kubectl describe pod coredns-57bbd778b9-kxl7b -n kube-system

root >> kubectl logs coredns-57bbd778b9-kxl7b -n kube-system

 

 

 

 

 

2. Modify the VM file before DNS resolution,

As shown below: cat /etc/resolv.conf is in 192.168.3.1 DNS name card set I VM physical machines, this is a virtual incorrect DNS address, actually I IP router.

docker exec -it fda365569efa / bin / bash, showing access to the interior dnsutils-ds-55fpd k8s container.

10.3.0.2, this is ClusterIP I k8s defined in the cluster and create CoreDNS container, if the deployment is successful, domain name service or access outside the network, you can do it through address resolution.

Question: below, inside the container, can not resolve the external address and the internal address cluster.local www.baidu.com normal. Here is a description of the physical machine VM nameserver configuration error.

 

3. Modify the VM after DNS resolution files,

NIC # modify the configuration file on the VM eno01 machine, as shown alternatively correct DNS address.

# Here we use Google's DNS domain name and local address 8.8.8.8 K8S cluster CoreDNS of CluterIP address 10.3.0.2.

root >> vi /etc/sysconfig/network-scripts/ifcfg-eno01

# Then remember to save, and then restart the VM machine, we re-examine CoreDNS resolution is normal, as follows:

root >> cat /etc/sysconfig/network-scripts/ifcfg-eno01

root >> cat /etc/resolv.conf

root >> ping -c 1 www.baidu.com

root >> ping -c 1 10.3.0.2

root >> ping -c 1 kubernetes

root >> nslookup www.baidu.com

root >> nslookup kubernetes

root >> nslookup kube-dns.kube-system.svc

root >> nslookup kube-dns.kube-system.svc.cluster.local

root >> nslookup cluster.local

 

#### docker dns resolve internal inspection

root >> docker ps | grep dns

dnsutils root >>

 

Guess you like

Origin www.cnblogs.com/itshare/p/11368998.html