Kubernetes仪表板无法正常工作

时间:2016-12-22 13:36:29

标签: kubernetes

我试图实现kubernetes仪表板但是它一直处于CrashLoopBackoff状态并且无论我部署它多少次都有相同的信念

host-xxx:~ # kubectl get pods --all-namespaces                                                                                                                                                                                          
NAMESPACE     NAME                                    READY     STATUS             RESTARTS   AGE
default       locust-master-pr59t                     1/1       Running            0          2d
default       my-nginx-2565190728-8z0eh               1/1       Running            0          2d
default       my-nginx-2565190728-if4my               1/1       Running            0          2d
kube-system   kubernetes-dashboard-1975554030-80rxv   0/1       CrashLoopBackOff   249        21h

我有“kubectl create -f https://rawgit.com/kubernetes/dashboard/master/src/deploy/kubernetes-dashboard-head.yaml”中的yaml文件

host-xxx:~ # kubectl describe pod --namespace=kube-system kubernetes-dashboard-1975554030-80rxv
Name:           kubernetes-dashboard-1975554030-80rxv
Namespace:      kube-system
Node:           host-44-11-1-25/44.11.1.25
Start Time:     Wed, 21 Dec 2016 14:49:48 +0000
Labels:         app=kubernetes-dashboard
                pod-template-hash=1975554030
Status:         Running
IP:             172.20.140.2
Controllers:    ReplicaSet/kubernetes-dashboard-1975554030
Containers:
  kubernetes-dashboard:
    Container ID:               docker://708aac5cebdff057b69cec94e582cb45f7dba424c336fb320dd0d5e3243fc323
    Image:                      gcr.io/google_containers/kubernetes-dashboard-amd64:v1.5.0
    Image ID:                   docker://sha256:e5133bac8024ac6c916f16df8790259b5504a800766bee87dcf90ec7d634a418
    Port:                       9090/TCP
    State:                      Waiting
      Reason:                   CrashLoopBackOff
    Last State:                 Terminated
      Reason:                   Error
      Exit Code:                1
      Started:                  Thu, 22 Dec 2016 11:32:12 +0000
      Finished:                 Thu, 22 Dec 2016 11:32:13 +0000
    Ready:                      False
    Restart Count:              244
    Liveness:                   http-get http://:9090/ delay=30s timeout=30s period=10s #success=1 #failure=3
    Environment Variables:      <none>
Conditions:
  Type          Status
  Initialized   True 
  Ready         False 
  PodScheduled  True 
No volumes.
QoS Tier:       BestEffort
Events:
  FirstSeen     LastSeen        Count   From                            SubobjectPath                           Type            Reason                  Message
  ---------     --------        -----   ----                            -------------                           --------        ------                  -------
  20h           3m              245     {kubelet host-44-11-1-25}       spec.containers{kubernetes-dashboard}   Normal          Pulling                 pulling image "gcr.io/google_containers/kubernetes-dashboard-amd64:v1.5.0"
  20h           3m              246     {kubelet host-44-11-1-25}                                               Warning         MissingClusterDNS       kubelet does not have ClusterDNS IP configured and cannot create Pod using "ClusterFirst" policy. Falling back to DNSDefault policy.
  20h           3m              245     {kubelet host-44-11-1-25}       spec.containers{kubernetes-dashboard}   Normal          Pulled                  Successfully pulled image "gcr.io/google_containers/kubernetes-dashboard-amd64:v1.5.0"
  20h           3m              236     {kubelet host-44-11-1-25}       spec.containers{kubernetes-dashboard}   Normal          Created                 (events with common reason combined)
  20h           3m              236     {kubelet host-44-11-1-25}       spec.containers{kubernetes-dashboard}   Normal          Started                 (events with common reason combined)
  20h           3s              5940    {kubelet host-44-11-1-25}       spec.containers{kubernetes-dashboard}   Warning         BackOff                 Back-off restarting failed docker container
  20h           3s              5906    {kubelet host-44-11-1-25}                                               Warning         FailedSync              Error syncing pod, skipping: failed to "StartContainer" for "kubernetes-dashboard" with CrashLoopBackOff: "Back-off 5m0s restarting failed container=kubernetes-dashboard pod=kubernetes-dashboard-1975554030-80rxv_kube-system(b893d9c4-c78c-11e6-bd87-fa163e39bb70)"

我不知道为什么我有这个错误信息,在minion上看起来图像被拉了,我可以用docker拉它..

你们对此有一个理论吗?

2 个答案:

答案 0 :(得分:1)

图像拉动成功且容器未能在POD中启动,在此阶段您可以检查出验证容器日志的问题:

kubectl logs --namespace=kube-system kubernetes-dashboard-1975554030-80rxv

kubelet发出警告:

  

kubelet没有配置ClusterDNS IP,也无法使用&#34; ClusterFirst&#34;政策。回归到DNSDefault政策。

也许问题与DNS有关,我有一个自定义安装,其中仪表板容器仅在DNS处于活动状态时启动,验证日志以了解它失败的原因。

答案 1 :(得分:0)

就像早期的回答所说的那样,

您可以使用命令kubectl logs --namespace=kube-system kubernetes-dashboard-1975554030-80rxv来检查有关所发生事件的错误详细信息。

错误kubelet does not have ClusterDNS IP configured and cannot create Pod using "ClusterFirst" policy. Falling back to DNSDefault policy.

也许您还没有启用kubedns组件,这可能会导致此问题。

如果您仍在使用https://rawgit.com/kubernetes/dashboard/master/src/deploy/kubernetes-dashboard-head.yaml创建kubernetes仪表板,则可以运行命令kubectl edit pod kubernetes-dashboard-1975554030-80rxv -n kube-system,以手动将DNS策略更改为默认值。密钥应为spec.template.spec.dnsPolicyDefault,然后重新创建此Pod以查看它是否有效。

更多细节可以在http://blog.kubernetes.io/2017/04/configuring-private-dns-zones-upstream-nameservers-kubernetes.html

中找到

顺便说一句,你也可以使用官方仪表板来创建https://github.com/kubernetes/dashboard#getting-started