美文网首页
nodelocaldns导致coredns hosts配置失效

nodelocaldns导致coredns hosts配置失效

作者: wwq2020 | 来源:发表于2022-05-22 12:23 被阅读0次

背景

同事部署的k8s 域名是在各个node上/etc/hosts中静态添加的,而不是在dns server上,手动在coredns中添加域名解析后发现pod中依然解析不了
因为部署了nodelocaldns(nodelocaldns不支持hosts插件),pod对于集群本身的域名解析会先访问nodelocaldns然后是coredns,但是对于非集群本身的会先访问nodelocaldns然后是/etc/resolve.conf中对应的nameserver(也就是不会经过coredns),所以直接在coredns中配置pod中是依然解析不了此域名

解决方案

第一种

部署dns server,在dns server中配置k8s域名指向相应的节点

第二种

修改nodelocaldns对应的configmap

image.png

修改之前是forward . /etc/resolv.conf

10.22.0.3改为coredns实际的clusterip

补充

coredns中添加自定义域名解析

.:53 {
        ...
        hosts {
          yourip yourdomain
          fallthrough
        }
  ...
}

相关文章

  • nodelocaldns导致coredns hosts配置失效

    背景 同事部署的k8s 域名是在各个node上/etc/hosts中静态添加的,而不是在dns server上,手...

  • CoreDNS篇3-接入prometheus监控

    本文主要对coredns的prometheus监控进行介绍,以及对grafana中配置coredns的dashbo...

  • kubernetes开启coredns日志

    默认的coredns配置没有开启日志插件,这导致kubernetes集群中一些dns解析超时问题难以定位。通过ku...

  • CoreDNS篇4-编译安装unbound

    本文主要介绍coredns的unbound插件进行编译安装的过程及常用的配置方法。 coredns官方的unbou...

  • Apache多站点

    配置vhost 配置hosts

  • hosts

    在我们的测试工作中,经常用到Hosts文件,那么什么是Hosts,为什么需要配置Hosts,以及如何配置Hosts...

  • react前端配置本地域名

    在hosts上配置域名hosts路径: C:\Windows\System32\drivers\etc\hosts...

  • mac apache 配置虚拟域名

    配置HOSTS #vim /private/etc/hosts 添加↓: 127.0.0.1 tp.zhy...

  • hosts配置

    layout: posttitle: Host配置date: 2019-9-26 10:42:0group:tag...

  • hosts配置

    在hosts文件内可配置ip地址和域名的对应关系,这样就能直接使用主机名找到对应的ip地址linux是在/etc/...

网友评论

      本文标题:nodelocaldns导致coredns hosts配置失效

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