1

If I have 2 namespaces A and B, attempting to reference a service from B using the standard DNS convention for k8s <svc-name>.<namespace>.svc.cluster.local fails

so from a a pod deployed in namespace B to reference db service deployed in namespace for example:

dbservice.A.svc.cluster.local

fails to resolve

Is there some additional configuration needed for the dns service to make this work ?

Sam D
  • 11
  • 1
  • I'm having the same issue. I can nslookup from a pod in the same namespace, but not from a different one. Did you find a fix for this? – Copil tembel Sep 22 '22 at 17:44
  • 1
    Yes so it seems using [ExternalName](https://kubernetes.io/docs/concepts/services-networking/service/#externalname) is the common way of doing this. If your service resides in namespace B for example and you want to reach it from A. You would create a service in A of **type: ExternalName** and then set the **externalName** to be the full svc name in B e.g. mysvc.B.svc.cluster.local – Sam D Sep 22 '22 at 23:37
  • I had a second issue with this. I am using hostNetwork: true in the deployment, so the DNS resolution for names like *.svc.cluster.local was not possible until I added dnsPolicy: "ClusterFirstWithHostNet" to the deployment. – Copil tembel Sep 25 '22 at 08:25

0 Answers0