一、CoreDNS的作用
CoreDNS用于实现 service --> cluster IP 的DNS解析。以容器的方式交付到k8s集群,由k8s自行管理,降低人为操作的复杂度。
二、配置nginx
在运维主机172.16.1.55上,配置一个nginx虚拟机,用以提供k8s统一资源配置清单访问入口。
[root@hdss1-55 ~]# cd /etc/nginx/conf.d/
[root@hdss1-55 conf.d]# vim k8s-yaml.od.com.conf
[root@hdss1-55 conf.d]# mkdir -p /data/k8s-yaml
[root@hdss1-55 conf.d]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@hdss1-55 conf.d]# nginx -s reload
三、DNS服务器回滚
172.16.1.51上操作
[root@hdss1-51 ~]# vim /var/named/od.com.zone
$ORIGIN od.com.
$TTL 600 ; 10 minutes
@ IN SOA dns.od.com. dnsadmin.od.com. (
**2020101903** ; serial
10800 ; refresh (3 hours)
900 ; retry (15 minutes)
604800 ; expire (1 week)
86400 ; minimum (1 day)
)
NS dns.od.com.
$TTL 60 ; 1 minute
dns A 172.16.1.51
harbor A 172.16.1.55
**k8s-yaml A 172.16.1.55**
[root@hdss1-51 ~]# systemctl restart named
[root@hdss1-51 ~]# dig -t A k8s-yaml.od.com @172.16.1.51 +short
172.16.1.55