nested exception is java.net.UnknownHostException when kubernetes pod start

2/12/2020

When the kuberentes pod start, give thie error messsage,my app using mybatis and when it start, the app must get the dtd file from mybatis server:

2020-02-12 08:29:22.903 ERROR 6 --- [           main] o.s.boot.SpringApplication               : Application run failed
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [mybatis/mybatis-config.xml]; nested exception is java.net.UnknownHostException: mybatis.org
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:415) ~[spring-beans-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]

I am very sure the host is exists,and I have tried to put the xml dtd file on my own static service,and the same error.I know it is maybe a DNS problem.I am using this command to check DNS service status,it give this tips:

 [root@ops001 ~]# /opt/k8s/bin/kubectl exec -ti soa-user-service-5c8b744d6d-7p9hr -n dabai-fat -- nslookup kubernetes.default
nslookup: can't resolve '(null)': Name does not resolve

nslookup: can't resolve 'kubernetes.default': Try again
command terminated with exit code 1

so what's the problem about this? This is the pod works fine /etc/resolve.conf:

nameserver 10.254.0.2
search dabai-fat.svc.cluster.local svc.cluster.local cluster.local
options ndots:5

I can't access the CoreDNS pods not working.The DNS pod running status:

[root@ops001 ~]# kubectl get pods --namespace=kube-system -l k8s-app=kube-dns
NAME                      READY   STATUS    RESTARTS   AGE
coredns-89764d78c-zhnwh   1/1     Running   1          4h4m

and this is the pod log output:

.:53
2020-02-12T07:54:32.194Z [INFO] CoreDNS-1.3.1
2020-02-12T07:54:32.194Z [INFO] linux/amd64, go1.11.4, 6b56a9c
CoreDNS-1.3.1
linux/amd64, go1.11.4, 6b56a9c
2020-02-12T07:54:32.194Z [INFO] plugin/reload: Running configuration MD5 = 8646128cd34ade07719a0787cce6943e
-- Dolphin
kubernetes

0 Answers