CoreDns配置以及外部dns使用

栏目: 数据库 · 发布时间: 6年前

内容简介:先来看看默认的CoreDns的配置文件有些服务不在kubernetes内部,在内部环境内需要通过dns去访问,名称后缀为完整的配置文件

先来看看默认的CoreDns的配置文件

Corefile: |
  .:53 {
      errors
      health
      kubernetes cluster.local in-addr.arpa ip6.arpa {
         pods insecure
         upstream
         fallthrough in-addr.arpa ip6.arpa
      }
      prometheus :9153
      forward . /etc/resolv.conf
      cache 30
      loop
      reload
      loadbalance
  }
  • error: 错误记录到stdout
  • health :CoreDNS的运行状况报告为 http:// localhost:8080 / health
  • kubernetes :CoreDNS将根据Kubernetes服务和pod的IP回复DNS查询
  • prometheus :CoreDNS的度量标准可以在 http://localhost:9153/ Prometheus格式的 指标 中找到
  • proxy :任何不在Kubernetes集群域内的查询都将转发到预定义的解析器(/etc/resolv.conf)
  • cache :启用前端缓存
  • loop :检测简单的转发循环,如果找到循环则停止CoreDNS进程
  • reload :允许自动重新加载已更改的Corefile。编辑ConfigMap配置后,请等待两分钟以使更改生效
  • loadbalance :这是一个循环DNS负载均衡器,可以在答案中随机化A,AAAA和MX记录的顺序

配置外部dns

有些服务不在kubernetes内部,在内部环境内需要通过dns去访问,名称后缀为 carey.com

carey:53 {
        errors
        cache 30
        proxy . 10.150.0.1
    }

完整的配置文件

Corefile: |
  .:53 {
      errors
      health
      kubernetes cluster.local in-addr.arpa ip6.arpa {
         pods insecure
         upstream
         fallthrough in-addr.arpa ip6.arpa
      }
      prometheus :9153
      forward . /etc/resolv.conf
      cache 30
      loop
      reload
      loadbalance
  }
  carey.com:53 {
      errors
      cache 30
      proxy . 10.150.0.1
  }

参考文档: https://kubernetes.io/docs/tasks/administer-cluster/dns-custom-nameservers/#coredns


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Persuasive Technology

Persuasive Technology

B.J. Fogg / Morgan Kaufmann / 2002-12 / USD 39.95

Can computers change what you think and do? Can they motivate you to stop smoking, persuade you to buy insurance, or convince you to join the Army? "Yes, they can," says Dr. B.J. Fogg, directo......一起来看看 《Persuasive Technology》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

MD5 加密
MD5 加密

MD5 加密工具

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换