Adding a extra DNS pod how to configure and handle

8/23/2019

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

-- mickmack
amazon-web-services
aws-eks
coredns
eks
kubernetes

1 Answer

8/23/2019

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
    }
-- Matt
Source: StackOverflow