External Name Resolution: Difference between revisions

From WilliamsNet Wiki
Jump to navigation Jump to search
(instructions on how to provide DNS overrides)
 
m (added customization instructions)
 
Line 10: Line 10:
   log.override: |
   log.override: |
     log
     log
   # Private DNS resolution example. Handles FQDN resolutions for *.mydomain.com
   # Private DNS resolution. Handles FQDN resolutions for *.williams.localnet
  # Replace <dns-private-ip> with the target IP address.
   dev.server: |
   dev.server: |
     williams.localnet.:53 {
     williams.localnet.:53 {
Line 21: Line 20:


  https://kubernetes.io/docs/tasks/administer-cluster/dns-custom-nameservers/
  https://kubernetes.io/docs/tasks/administer-cluster/dns-custom-nameservers/
Note that the '*.override' tag is different from the online documentation.  The correct label was identified by looking at the standard 'coredns' ConfigMap to see where and how these custom sections are added.
You can include multiple *.override sections and multiple *.server sections if needed to include all the overrides desired.

Latest revision as of 23:07, 27 March 2025

While the coredns configuration is supposed to refer all non-cluster names out to the system defined DNS resolver, it seems that it doesn't always happen. It may be related to the observation I've made that the nameserver IP in the /etc/resolv.conf file is changed to 127.0.0.53 - which doesn't always work. In any case, the coredns configuration allows you to add custom domain override definitions by creating a ConfigMap named 'coredns-custom' using a YAML file like this:

ApiVersion: v1
kind: ConfigMap
metadata:
  name: coredns-custom
  namespace: kube-system
data:
  # Log all incoming DNS queries.
  log.override: |
    log
  # Private DNS resolution. Handles FQDN resolutions for *.williams.localnet
  dev.server: |
    williams.localnet.:53 {
      forward . 10.0.0.254
    }

The general process is described in the online kubernetes documentation:

https://kubernetes.io/docs/tasks/administer-cluster/dns-custom-nameservers/

Note that the '*.override' tag is different from the online documentation. The correct label was identified by looking at the standard 'coredns' ConfigMap to see where and how these custom sections are added.

You can include multiple *.override sections and multiple *.server sections if needed to include all the overrides desired.