CoreDNS 域名添加

云原生CoreDNS约 114 字小于 1 分钟

Host解析设置

通过修改 CoreDNS ConfigMap, 即可实现,无限在values中添加过多的HostAlias

kubectl edit configmap coredns -n kube-system

host {} 内容,即为自定义域名,且fallthrough 必须配置,否则其他域名将无法解析

Corefile: |
    .:53 {
        errors
        health {
          lameduck 5s
        }
        ready
        kubernetes cluster.local in-addr.arpa ip6.arpa {
          pods insecure
          fallthrough in-addr.arpa ip6.arpa
        }
        hosts {
         192.168.2.149 harbor.zili.work
         192.168.4.14 minio.jkstack.com
         fallthrough
        }
        prometheus :9153
        forward . "/etc/resolv.conf"
        cache 30
        loop
        reload
        loadbalance
    }