4
votes

I have setup an Azure Kubernetes Cluster using kubenet plugin. All pods and services are running. Also, when I do a kubectl get pods -n kube-system all pods are running.

The issue I have is, the pods are unable to connect to other pods via hostnames. However, if I use the pod ip addresses : portname, they are able to connect.

When I am logged into a pod and do a curl ex: pod-x$ curl http://my-pod-y:2000/analysis

I get the error:

could not resolve host http://my-pod-y

But when I delete all the coredns pods with kube-system namespaces, and retry the curl commands within the pod, they are able to access the other pods using hostnames!

But when I try after 10 mins it gives the could not resolve host error.

Any pointers on this will be much appreciated.

1
Stack Overflow is a site for programming and development questions. You should probably use another site on the Stack Exchange network for this question. Also see What topics can I ask about here in the Help Center. - jww
the above question is centered around devops where it is a mix of manifest code and the software tool (kubernetes) itself. Is stackoverflow not suited for any devops questions? Similar questions have already been asked and answered in Stackoverflow, I dont seem to find the answer for the scenario that I am facing. - jack
Why is this question down voted? - jack
try updating\reinstalling aks? this seems like an issues with coredns. it might be specific to that particular version - 4c74356b41
are you connecting to the pod by its name or by service name? - Matt

1 Answers

0
votes

Kuberentes uses different DNS schemes for PODs.

The DNS schema for a Pod in the default NS with IP 172.17.0.3 is :

172-17-0-3.default.pod.cluster.local
pod-ip-address.namespace.pod.cluster-domain.example

If you want to use DNS name, you have to uses services. For a Service test in the default NS the DNS record is:

test.default.svc.cluster.local
svc.namespace.svc.cluster-domain.example

You can check this here: https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/