美文网首页
使用coredns解决xip.io解析速度慢的问题

使用coredns解决xip.io解析速度慢的问题

作者: 何以致区区丶 | 来源:发表于2019-03-25 11:29 被阅读0次

    之前公司内部的kubernetes集群,在对其他事业部提供服务的时候,因为服务偏多,所以从nodePort方式改为了ingress暴露服务。使用xip.io这个公网解析来配置域名,但是由于在域名解析的过程中需要访问该网站,解析速度较慢,因此采用了coredns来解决此问题,代替xip.io来解析kubernetes的ingress服务。

    1、ingress-controller部署就不做陈述,直接讲如何使用coredns来解析一个示例服务。

    2、下载coredns:

wget https://github.com/coredns/coredns/releases/download/v1.3.0/coredns_1.3.0_linux_amd64.tgz

    3、配置Corefile文件如下:

. {

    proxy . 223.5.5.5:53 {

        except example.com

        protocol dns

    }

    prometheus    # enable metrics

    errors stdout  # show errors

    log stdout    # show query logs

}

example.org {

    file /etc/coredns/zones/example.com

    prometheus    # enable metrics

    errors stdout  # show errors

    log stdout    # show query logs

}

4、配置example.com文件:

$ORIGIN example.com.

@      3600 IN SOA sns.dns.icann.org. noc.dns.icann.org. (

                                2017042745 ; serial

                                7200      ; refresh (2 hours)

                                3600      ; retry (1 hour)

                                1209600    ; expire (2 weeks)

                                3600      ; minimum (1 hour)

                                )

    3600 IN NS a.iana-servers.net.

        3600 IN NS b.iana-servers.net.

*      IN A    10.10.0.0

ps:10.10.0.0是ingress-controller的pod所在的node ip。

5、部署ingress服务:

示例服务:https://github.com/nginxinc/kubernetes-ingress/tree/master/examples/complete-example

kubectl -f cafe*

6、coredns测试:

在测试机器上面编辑/etc/resove.conf

nameserver corednsIP

curl https://cafe.example.com/coffee --insecure

相关文章

网友评论

      本文标题:使用coredns解决xip.io解析速度慢的问题

      本文链接:https://www.haomeiwen.com/subject/behvvqtx.html