How do I configure a conditional forwarder with CoreDNS in my Amazon EKS cluster?
Last updated: 2020-10-28
I want to configure a conditional forwarder with CoreDNS in my Amazon Elastic Kubernetes Service (Amazon EKS) cluster.
Short description
You can use CoreDNS to configure conditional forwarding for DNS queries sent to the domains resolved by a customized DNS server.
Resolution
1. To modify the CoreDNS ConfigMap and add the conditional forwarder configuration, run the following command:
$ kubectl -n kube-system edit configmap coredns
The output should look similar to the following:
apiVersion: v1
kind: ConfigMap
metadata:
annotations:
labels:
eks.amazonaws.com/component: coredns
k8s-app: kube-dns
name: coredns
namespace: kube-system
data:
Corefile: |
.:53 {
errors
health
kubernetes cluster.local in-addr.arpa ip6.arpa {
pods insecure
upstream
fallthrough in-addr.arpa ip6.arpa
}
prometheus :9153
forward . /etc/resolv.conf
cache 30
loop
reload
loadbalance
}
domain-name:53 {
errors
cache 30
forward . custom-dns-server
reload
}
Note: Replace domain-name with your domain name. Replace custom-dns-server with your custom DNS server IP address.
2. To verify that domain name resolution works, run the following command:
$ kubectl run busybox --restart=Never --image=busybox:1.28 -- sleep 3600
$ kubectl exec busybox -- nslookup domain-name
Note: Replace domain-name with your domain name.
Did this article help?
Do you need billing or technical support?