今日排错---CoreDNS提示dial tcp 192.168.0.1:443: connect: no route to host

现象

部署CoreDNS后发现DNS没有生效

日志

[root@ln0-184 flannel]# kubectl logs -n500 coredns-7858589dd4-zd8w5 -n kube-system
E0331 03:03:33.835536       1 reflector.go:125] pkg/mod/k8s.io/client-go@v0.0.0-20190620085101-78d2af792bab/tools/cache/reflector.go:98: Failed to l/192.168.0.1:443/api/v1/services?limit=500&resourceVersion=0: dial tcp 192.168.0.1:443: connect: no route to host
...以下省略...

原因

iptables 规则没有清理干净/乱了

处理

# 停止kubelet
supervisorctl stop kube-kubelet-0-184 #根据配置方式使用对应命令停止kubelet: kubelet systemctl stop kubelet
kill-9 kubelet进程号
#systemctl stop kubelet
# 停止docker
systemctl stop docker
# 刷新iptables
iptables --flush
iptables -tnat --flush
# 启动kubelet
supervisorctl start kube-kubelet-0-184 #根据配置方式使用对应命令启动kubelet: systemctl start kubelet
# 启动docker
systemctl start docker
# 验证
[root@ln0-184 bin]# dig -t A www.baidu.com @192.168.0.2 +short
112.80.248.76
112.80.248.75
posted @ 2021-03-31 12:29  骁珺在努力  阅读(4593)  评论(0编辑  收藏  举报