Table of Contents
< All Topics
Print

coredns custom domain name resolution hosts

Problem Description

Custom DNS domain resolution using hosts with coredns

Alert Information

NA

Effective Troubleshooting Steps

NA

Root Cause

NA

Solution

Use kubectl edit configmap coredns -n kube-system to add host entries inside the hosts{} section for the corresponding domain resolution Please configure fallthrough, otherwise it will cause non-customized Hosts domain resolution to fail

apiVersion: v1
data:
  Corefile: |
    .:53 {
        errors
        health {
           lameduck 5s
        }
        ready
        
        hosts {
          127.0.0.1 www.example.com
          fallthrough
        }
        
        kubernetes cluster.local in-addr.arpa ip6.arpa {
           pods insecure
           fallthrough in-addr.arpa ip6.arpa
           ttl 30
        }
        prometheus :9153
        forward . /etc/resolv.conf {
           max_concurrent 1000
        }
        cache 30
        loop
        reload
        loadbalance
    }
 

Scope of Operation Impact

NA

Is It a Temporary Solution

NA

Suggestions and Summary

NA

Troubleshooting Content

NA

Original Link

https://support.sangfor.com.cn/cases/list?product_id=37&type=1&category_id=29264&isOpen=true