0

I have an AKS kubernetes cluster inside a virtual network on azure with mainly linux pods.

In the same virtual network there is a windows server hosting a DNS server and domain controller for the domain mydomain.local, also other windows VMs that pods in AKS need access to.

We have set the domain controller ip address in the virtual network settings so that AKS actually works using it to resolve names. Name resolution is ok as long as the FQDN of the destination VM is used, like "sql-server.mydomain.local".

I would like to be able in a pod to reference the VM by simple name (i.e.: "sql-server") without specifying the full domain name. Normally on premises I would simply edit the /etc/resolv.conf of the kubernetes nodes, adding the search domain there.

I know how to edit the CoreDNS settings via coredns-custom ConfigMap, but I cannot find any setting about adding a search domain for the pods.

Is there any way to do this actually?

Thank you

asked Nov 8, 2019 at 15:25

1 Answer 1

1

I suggest you read first about DNS in kubernetes https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-s-dns-policy Especially about Pod’s DNS Policy.

In my case I was able to add search domain for each deployment. Setting is dnsConfig. It does append search domain to the resolv.conf See example below

spec:
 tolerations:
 - key: node-role.kubernetes.io/master
 effect: NoSchedule
 containers:
 - name: ubuntu
 image: ubuntu
 args:
 - sleep
 - "10000"
 nodeSelector:
 beta.kubernetes.io/os: linux
 dnsConfig:
 searches:
 - example.local

Resolv.conf then has "example.local" domain in it.

cat /etc/resolv.conf 
 nameserver 10.96.0.10
 search default.svc.cluster.local svc.cluster.local cluster.local example.local
 options ndots:1

Hope this will help in your case too.

answered Nov 14, 2019 at 13:11
1
  • hi and thank you for your answer. adding the dns to the pod/deployment yaml works correctly but duplicating the search domain into each deployment/stateful-set is really bad, there should be something cluster-wide (or docker-wide?) to do the same thing on default for every pod Commented Nov 18, 2019 at 15:10

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.