Smart33690
# 修改coredns
$ kubectl -n kube-system edit cm coredns
# health块下新增
# 修改技巧,对应上面hosts文件的节点+vip+harbor的地址映射信息
hosts {
10.0.1.xxx master1.cluster.local master1
10.0.1.xxx master2.cluster.local master2
10.0.1.xxx master3.cluster.local master3
10.0.1.xxx node1.cluster.local node1
10.0.1.xxx node2.cluster.local node2
10.0.1.xxx node3.cluster.local node3
10.0.1.xxx lb.kubesphere.local
10.0.1.xxx harbor.dockerregistry.com
fallthrough
}
# 修改nodelocaldns
$ kubectl -n kube-system edit cm nodelocaldns
# kind属性标签上一个53块下修改
# 修改技巧,注释原有行,新增
#forward . /etc/resolv.conf
forward . 10.233.0.3 {
force_tcp
}
# 删除旧的dns的pod,系统会自动启用新的dns
$ kubectl delete -n kube-system pod `kubectl get pod -A|grep dns|awk '{print $2}'`
# 查看新的dns的pod
$ kubectl get pod -A|grep dns
# 首先验证域名问题
# 安装工具包
$ yum -y install bind-utils
# 验证node1的域名解析问题
# 用法: nslookup 域名 dns地址
$ nslookup node1 ` kubectl get svc -A|grep dns|awk '{print $4}'`