Kubernetes仪表板CrashLoopBackOff,获取错误“连接:主机无路由”,我该如何解决?

时间:2018-09-12 01:54:51

标签: kubernetes kubernetes-dashboard

我已经部署了Kubernetes仪表板,该仪表板最终以CrashLoopBackOff状态出现。当我跑步时:

$ kubectl logs kubernetes-dashboard-767dc7d4d-mc2sm --namespace=kube-system

输出为:

Error from server: Get https://10.4.211.53:10250/containerLogs/kube-system/kubernetes-dashboard-767dc7d4d-mc2sm/kubernetes-dashboard: dial tcp 10.4.211.53:10250: connect: no route to host

我该如何解决?这是否意味着端口10250未打开?


更新:

@LucaBrasi
Error from server (NotFound): pods "kubernetes-dashboard-767dc7d4d-mc2sm" not found

systemctl status kubelet --full输出为:

kubelet.service - kubelet: The Kubernetes Node Agent
   Loaded: loaded (/etc/systemd/system/kubelet.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/kubelet.service.d
           └─10-kubeadm.conf
   Active: active (running) since 一 2018-09-10 15:04:57 CST; 1 day 23h ago
     Docs: https://kubernetes.io/docs/
 Main PID: 93440 (kubelet)
    Tasks: 21
   Memory: 78.9M
   CGroup: /system.slice/kubelet.service
           └─93440 /usr/bin/kubelet --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf --config=/var/lib/kubelet/config.yaml --cgroup-driver=cgroupfs --cni-bin-dir=/opt/cni/bin --cni-conf-dir=/etc/cni/net.d --network-plugin=cni

kubectl get pods --all-namespaces的输出

NAMESPACE NAME READY STATUS RESTARTS AGE kube-system coredns-78fcdf6894-qh6zb 1/1 Running 2 3d kube-system coredns-78fcdf6894-xbzgn 1/1 Running 1 3d kube-system etcd-twsr-whtestserver01.garenanet.com 1/1 Running 2 3d kube-system kube-apiserver-twsr-whtestserver01.garenanet.com 1/1 Running 2 3d kube-system kube-controller-manager-twsr-whtestserver01.garenanet.com 1/1 Running 2 3d kube-system kube-flannel-ds-amd64-2bnmx 1/1 Running 3 3d kube-system kube-flannel-ds-amd64-r58j6 1/1 Running 0 3d kube-system kube-flannel-ds-amd64-wq6ls 1/1 Running 0 3d kube-system kube-proxy-ds7lg 1/1 Running 0 3d kube-system kube-proxy-fx46d 1/1 Running 0 3d kube-system kube-proxy-ph7qq 1/1 Running 2 3d kube-system kube-scheduler-twsr-whtestserver01.garenanet.com 1/1 Running 1 3d kube-system kubernetes-dashboard-767dc7d4d-mc2sm 0/1 CrashLoopBackOff 877 3d

1 个答案:

答案 0 :(得分:0)

从您链接的教程中复制所有步骤时,我遇到了同样的问题-我的仪表板处于CrashLoopBackOff状态。在执行了此步骤并从官方github文档中应用了新的仪表板Yaml(与您发布的仪表板似乎没有什么不同)之后,仪表板工作正常。

首先,列出与Kubernetes仪表板相关的所有对象:

kubectl get secret,sa,role,rolebinding,services,deployments --namespace=kube-system | grep dashboard

删除它们:

kubectl delete deployment kubernetes-dashboard --namespace=kube-system 
kubectl delete service kubernetes-dashboard  --namespace=kube-system 
kubectl delete role kubernetes-dashboard-minimal --namespace=kube-system 
kubectl delete rolebinding kubernetes-dashboard-minimal --namespace=kube-system
kubectl delete sa kubernetes-dashboard --namespace=kube-system 
kubectl delete secret kubernetes-dashboard-certs --namespace=kube-system
kubectl delete secret kubernetes-dashboard-key-holder --namespace=kube-system

现在应用Kubernetes仪表板Yaml:

kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml

请告诉我这是否也对您有用,如果可行,请将其视为解决方法,因为我尚不知道原因-我正在调查。