cnoe-io / idpbuilder

Spin up a complete internal developer platform with only Docker required as a dependency.
https://cloud-native.slack.com/archives/C05TN9WFN5S
Apache License 2.0
174 stars 56 forks source link

configure core dns for internal name resolution #317

Closed nabuskey closed 3 months ago

nabuskey commented 3 months ago

fixes: #300

This allows for in-cluster hostname resolutions using CoreDNS.

From a pod in the cluster:

root@debug-pod:/# dig cnoe.localtest.me +short
10.96.30.155
root@debug-pod:/# dig abc.cnoe.localtest.me +short
10.96.30.155

A few points about CoreDNS I should make clear:

  1. CoreDNS file allows you to import files matching a pattern.
  2. By default, CoreDNS installation only mounts the corefile key within coredns CM.

Taken together, what we need to do to allow our default customization and possible further customization:

  1. Update the coredns CM to use the import plugin, then make it look for files matching /etc/coredns-configs/*.conf
  2. Populate /etc/coredns-configs/ with two files (sourced from CMs):
    • One that contains our default configuration. That is to resolve the name given by the host flag and all subdomains to the internal ingress address.
    • One that is empty. This is to allow for other packages to update this file for further DNS configurations. In the absence of this file, other packages must update the coredns deployment.
  3. Update the coredns deployment to mount the two CMs.