首页 > 其他分享 >coredns使用etcd

coredns使用etcd

时间:2023-01-30 14:12:45浏览次数:35  
标签:1.2 etcdctl 192.168 etcd 使用 coredns example

前言

CoreDNS使用ETCD存储主机记录。etcd安装略过。

Corefile内容

.:53 {
    # 绑定本机IP
    bind 192.168.1.2
    # etcd地址
    etcd {
        path /coredns
        endpoint http://192.168.1.2:2379
        fallthrough
    }
    # 最后所有的都转发到系统配置的上游dns服务器去解析
    forward . /home/apps/coredns/conf/forwards
    # 缓存时间ttl
    cache 1800
    # 自动加载配置文件的间隔时间
    reload 6s
    # 输出日志
    log
    # 输出错误
    errors
}

forwards内容

nameserver 223.6.6.6
nameserver 223.5.5.5

etcd相关操作

  • 添加主机记录
etcdctl put /coredns/com/example/x1 '{"host":"192.168.1.3","ttl":60}'
  • 查看所有主机记录
etcdctl get --prefix /coredns
  • 删除指定主机记录
etcdctl del /coredns/com/example/x1

nslookup测试

nslookup example.com 192.168.1.2

标签:1.2,etcdctl,192.168,etcd,使用,coredns,example
From: https://www.cnblogs.com/XY-Heruo/p/17075718.html

相关文章