# CoreDns部署 ``` Coredns的安装 root@ubuntu:~# wget https://github.com/coredns/coredns/releases/download/v1.2.1/coredns_1.2.1_linux_amd64.tgz root@ubuntu:~# tar xf coredns_1.2.1_linux_amd64.tgz root@ubuntu:~# chmod +x coredns && mv coredns /opt/kubernetes/bin/ 配置corefile配置文件 root@ubuntu:~# vim /opt/kubernetes/cfg/Corefile .:53 { kubernetes {{ CLUSTER_DNS_DOMAIN }} { resyncperiod 10s endpoint http://127.0.0.1:8080 pods verified endpoint_pod_names upstream /etc/resolv.conf } health :18080 log errors prometheus :9153 proxy . /etc/resolv.conf cache 30 reload 10s } 配置服务启动配置文件 root@ubuntu:~# vim /lib/systemd/system/coredns.service Description=coredns: The Coredns Server Documentation=https://coredns.io/ [Service] ExecStart=/opt/kubernetes/bin/coredns -conf /opt/kubernetes/cfg/Corefile Restart=always StartLimitInterval=0 RestartSec=10 [Install] WantedBy=multi-user.target root@ubuntu:~# systemctl start coredns ```