kube-dns fails on Ubuntu16.04.4

引子

最近被迫用回Ubuntu16.04.4,发现minikube起不来。
观察后发现是kube-dns一直起不来,报错。类似下面

k8s.io/dns/pkg/dns/dns.go:150: Failed to list *v1.Service: Get [https://10.96.0.1:443/api/v1/services?resourceVersion=0](https://10.96.0.1/api/v1/services?resourceVersion=0): dial tcp 10.96.0.1:443: getsockopt: no route to host

寻寻觅觅

在网上寻觅了很久,发现了一个解决方案。
(转)dial tcp 10.96.0.1:443: getsockopt: no route to host — kubernetes(k8s)DNS 服务反复重启

自己写了个小脚本

$ cat /usr/bin/fixminikube 
systemctl stop kubelet
systemctl stop docker
cp /home/elluffn/Nutstore/resolv.conf /etc/resolv.conf
iptables --flush
iptables -tnat --flush
systemctl start kubelet
systemctl start docker

minikube stop
#minikube delete
kubeadm reset
minikube start --vm-driver=none

注意,上面重置了resolv.conf 是为了去除里面的127.0.x.x 的nameserver.

    原文作者:qingguee
    原文地址: https://www.jianshu.com/p/8920ce57475b
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞