0- Default Coredns config
.:53 {
errors
health
ready
kubernetes cluster.local in-addr.arpa ip6.arpa {
pods verified
fallthrough in-addr.arpa ip6.arpa
}
autopath @kubernetes
prometheus :9153
forward . /etc/resolv.conf
cache 30
loop
reload
loadbalance
}
1- Add following configuration to top
of the kube-system
->config-map
->coredns
->Corefile
<domain>:53 {
errors
cache 30
forward . <name server>
}
Example :
topdomain.com:53 {
errors
cache 30
forward . 8.8.8.8
}
2- Restart pods by deleting coredns
pods from kube-system
to reload configuration.
kubectl -n kube-system get pod
kubectl -n kube-system delete pod <pod_id>
3- Done!
<first host> <second host> {
hosts {
<first ip> <first host>
<second ip> <second host>
fallthrough
}
whoami
}
For example:
test.domain {
hosts {
127.0.0.1 test.domain
fallthrough
}
whoami
}
test2.domain test3.domain {
hosts {
127.0.0.2 test2.domain
127.0.0.3 test3.domain
fallthrough
}
whoami
}