1
votes

I want to add a extra DNS server as a pod (internal for the other pods).

Kube-DNS works fine, the pods can resolve the short-names of the others and could find the extra dns-pod by : #>host dns

So far so good. The resolve.conf on all of the pods have only the coredns entry (namesever CLUSTER_IP).

I I manually add a second name server to the resolve.conf but it do not work. Now I thought about a extra rule in the Kube-DNS to forward requests to the dns-pod. But have no idea if this is the right way to go. Furthermore I do not know the ip of the dns-pod during auto-creation of the complete setup (terraform).

Would be nice to receive some tips how this should be done.

best

1
Can you explain what you are trying to achieve by adding the extra DNS server? CoreDNS can be configured to do a lot of things, it probably supports whatever you are trying to add. - Matt
The other pods should add extra domains to the dns-pod (pod1.domain=> external ip, pod1-internal.domain=> internal ip and so on) . But before they have to resolve the dos-pod to know were it is. - mickmack
Ok.. would need a more detailed explanation to see if coredns could manage the service for you, but it can at least do the forwarding. - Matt

1 Answers

1
votes

Setup a Service for your DNS pod, specifying a cluster IP in your allocated cluster service range.

apiVersion: v1
kind: Service
metadata:
  name: my-dns-service
spec:
  selector:
    app: dns-app
  ports:
    - protocol: UDP
      port: 53
      targetPort: 53
    - protocol: TCP
      port: 53
      targetPort: 53
  clusterIP: 10.233.8.8

Configure CoreDNS to forward your custom domains to that cluster IP.

Modify the coredns ConfigMap to include the forward plugin

    domain:53 {
        errors
        cache 30
        forward . 10.233.8.8
    }
    internal.domain:53 {
        errors
        cache 30
        forward . 10.233.8.8
    }