云容器引擎 CCE-合理配置CoreDNS:合理配置DNS存根域

时间:2024-04-03 08:02:33

合理配置DNS存根域

  1. 登录CCE控制台,单击集群名称进入集群。
  2. 在左侧导航栏中选择“插件中心”,在CoreDNS下单击“编辑”,进入插件详情页。
  3. “参数配置”下添加存根域。格式为一个键值对,键为DNS后缀域名,值为一个或一组DNS IP地址,如 'consul.local --10.150.0.1'。

  4. 单击“确定”完成配置更新。
  5. 在左侧导航栏中选择“配置与密钥”,在“kube-system”命名空间下,查看名为coredns的配置项数据,确认是否更新成功。

    对应Corefile内容如下:

    .:5353 {
        bind {$POD_IP}
        cache 30
        errors
        health {$POD_IP}:8080
        kubernetes cluster.local in-addr.arpa ip6.arpa {
            pods insecure
            fallthrough in-addr.arpa ip6.arpa
        }
        loadbalance round_robin
        prometheus {$POD_IP}:9153
        forward . /etc/resolv.conf {
            policy random
        }
        reload
        ready {$POD_IP}:8081
    }
    consul.local:5353 {
        bind {$POD_IP}
        errors
        cache 30
        forward . 10.150.0.1
    }

support.huaweicloud.com/bestpractice-cce/cce_bestpractice_0357.html