如何重启卡在挂起状态的 kubernetes-pod?

How to restart a kubernetes-pod stuck in pending state?

我正在设置 Kubernetes 主节点。 只有主节点,暂时没有工作节点。

设置已完成,使用 this tutorial. 没有任何问题现在,

$kubectl get pods -o wide --all-namespaces
kube-system   calico-kube-controllers-694687c474-96b7h   0/1     Pending   0          4h19m   <none>          <none>             <none>           <none>
kube-system   coredns-86c58d9df4-dv847                   0/1     Pending   0          4h28m   <none>          <none>             <none>           <none>
kube-system   coredns-86c58d9df4-pqvxv                   0/1     Pending   0          4h28m   <none>          <none>             <none>           <none>
kube-system   etcd-ip-172-31-40-128                      1/1     Running   0          4h28m   172.31.40.128   ip-172-31-40-128   <none>           <none>
kube-system   kube-apiserver-ip-172-31-40-128            1/1     Running   0          4h28m   172.31.40.128   ip-172-31-40-128   <none>           <none>
kube-system   kube-controller-manager-ip-172-31-40-128   1/1     Running   0          4h28m   172.31.40.128   ip-172-31-40-128   <none>           <none>
kube-system   kube-proxy-zvgcl                           1/1     Running   0          4h28m   172.31.40.128   ip-172-31-40-128   <none>           <none>
kube-system   kube-scheduler-ip-172-31-40-128            1/1     Running   0          4h27m   172.31.40.128   ip-172-31-40-128   <none>           <none>
kube-system   kubernetes-dashboard-57df4db6b-wlv86       0/1     Pending   0          3h55m   <none>          <none>    

当我尝试使用打开 Kubernetes 仪表板时, http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/ 在本地浏览器中,它无法打开仪表板,我在浏览器中收到以下错误:

{
  "kind": "Status",
  "apiVersion": "v1",
  "metadata": {

  },
  "status": "Failure",
  "message": "no endpoints available for service \"kubernetes-dashboard\"",
  "reason": "ServiceUnavailable",
  "code": 503
}

我假设 kubernetes-dashboard pod 处于待处理状态,因此仪表板无法打开。我如何让它为我工作?

感谢任何帮助。

您可以执行 kubectl describe pod kubernetes-dashboard-57df4db6b-wlv86,输出应该会告诉您无法安排 Pod 的原因。可能有不同的原因 kubernetes 'debug pods' guide covers several of them. The most common is insufficient resources but it could be other things, especially on a new cluster. I notice the DNS pods are also pending - I'd suggest looking at those first as you .