error execution phase preflight: couldn't validate the identity of the API Server: Get https://192.168.152.126:6443/.../timeout=10s: dial tcp 192.168.152.126:6443: connect: no route to host


kubernetes(k8s)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: dial tcp 10.96.0.1:443: getsockopt: no route to host

在使用 Minikube 部署 kubernetes 服務時,出現 Kube DNS 服務反復重啟現象(錯誤如上),

這很可能是 iptables 規則亂了,我通過執行以下命令解決了,在此記錄:

1.回到kubernees-maser 依次輸入列命令
systemctl stop kubelet
systemctl stop docker
iptables --flush
iptables -tnat --flush
systemctl start kubelet
systemctl start docker


  2.重新生成新token

  在kubernetse-master重新生成token:

# kubeadm token create

  424mp7.nkxx07p940mkl2nd

# openssl x509 -pubkey -in /etc/kubernetes/pki/ca.crt | openssl rsa -pubin -outform der 2>/dev/null | openssl dgst -sha256 -hex | sed 's/^.* //'

  d88fb55cb1bd659023b11e61052b39bbfe99842b0636574a16c76df186fd5e0d

 

   3.在kubernetes-slave中執行此命令 join就成功了

#  kubeadm join 192.168.169.21:6443 –token 424mp7.nkxx07p940mkl2nd \ --discovery-token-ca-cert-hash sha256:d88fb55cb1bd659023b11e61052b39bbfe99842b0636574a16c76df186fd5e0d

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM