Problem with DNS resolucion (only sometimes)


#1

Hello all, i have a strange problem with dns resolution. I created a deployment and service but when i try to ping the service in a busybox pod sometimes works and sometime fails:

/ # ping test
ping: bad address ‘test’

/ # ping test
PING test (10.107.190.1): 56 data bytes

randomly resolves sometimes the ip and sometimes not

In all cases the wait is very long

definition:

apiVersion: apps/v1
kind: Deployment
metadata:
name: test
spec:
selector:
matchLabels:
app: test
replicas: 1
template:
metadata:
labels:
app: test
spec:
containers:
- name: test
image: nginx

apiVersion: v1
kind: Service
metadata:
name: test
spec:
selector:
app: test
ports:
- protocol: TCP
port: 8080

logs of coredns:

coredns1:

10.244.1.79:44670 - [04/Oct/2018:08:59:30 +0000] 3 “AAAA IN test.default.svc.cluster.local. udp 48 false 512” NOERROR qr,aa,rd,ra 141 315.266µs
10.244.1.79:51241 - [04/Oct/2018:08:59:36 +0000] 2 “AAAA IN test.default.svc.cluster.local. udp 48 false 512” NOERROR qr,rd,ra 141 153.779µs
10.244.1.79:41768 - [04/Oct/2018:09:00:04 +0000] 4 “AAAA IN test.default.svc.cluster.local. udp 48 false 512” NOERROR qr,aa,rd,ra 141 233.389µs
10.244.1.79:39020 - [04/Oct/2018:09:00:24 +0000] 2 “AAAA IN test.default.svc.cluster.local. udp 48 false 512” NOERROR qr,rd,ra 141 128.122µs
10.244.1.79:46060 - [04/Oct/2018:09:00:24 +0000] 3 “A IN test.default.svc.cluster.local. udp 48 false 512” NOERROR qr,aa,rd,ra 94 193.35µs
10.244.1.79:49243 - [04/Oct/2018:09:01:09 +0000] 7 “A IN test.default.svc.cluster.local. udp 48 false 512” NOERROR qr,aa,rd,ra 94 232.978µs

coredns2:

2018/10/03 12:08:15 [INFO] CoreDNS-1.1.3
2018/10/03 12:08:15 [INFO] linux/amd64, go1.10.1, b0fd575c
2018/10/03 12:08:15 [INFO] plugin/reload: Running configuration MD5 = 63f0056dbcb0e6785c6e2f33ec0182a6
.:53
CoreDNS-1.1.3
linux/amd64, go1.10.1, b0fd575c

$ kubectl version
Client Version: version.Info{Major:“1”, Minor:“11”, GitVersion:“v1.11.3”, GitCommit:“a4529464e4629c21224b3d52edfe0ea91b072862”, GitTreeState:“clean”, BuildDate:“2018-09-09T18:02:47Z”, GoVersion:“go1.10.3”, Compiler:“gc”, Platform:“linux/amd64”}
Server Version: version.Info{Major:“1”, Minor:“11”, GitVersion:“v1.11.3”, GitCommit:“a4529464e4629c21224b3d52edfe0ea91b072862”, GitTreeState:“clean”, BuildDate:“2018-09-09T17:53:03Z”, GoVersion:“go1.10.3”, Compiler:“gc”, Platform:“linux/amd64”}

any ideas?

Thank u so much!


#2

I think pod-cidr used for the cluster is allocated hosts in your corporate network and causing conflicts.
did you try below command from the host
host (ip address of th pod ) example host 10.107.190.1