云容器引擎 CCE-使用CoreDNS实现自定义域名解析:使用CoreDNS级联自建DNS

时间:2024-05-17 11:30:04

使用CoreDNS级联自建DNS

CoreDNS默认使用节点的/etc/resolv.conf文件进行解析,您也可以修改成外部DNS的解析地址。

  1. 登录CCE控制台,单击集群名称进入集群。
  2. 在左侧导航栏中选择“插件中心”,在CoreDNS下单击“编辑”,进入插件详情页。
  3. “参数配置”下编辑高级配置,在plugins字段修改以下内容。

    {
        "configBlock": "policy random",
        "name": "forward",
        "parameters": ". 192.168.1.1"
    }
    图4 使用CoreDNS级联自建DNS

  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 . 192.168.1.1 {
            policy random
        }
        reload
        ready {$POD_IP}:8081
    }

support.huaweicloud.com/usermanual-cce/cce_10_0361.html