CoreJava CGLib动态代理 Eclipse 另类堆栈 希腊字母 svn docker容器 razor mvvm drupal concurrency tags seo Pure CSS vue教程 vue响应式 list获取最后一个元素 android逆向工程师 idea导入多个项目 ubuntu查看python版本 python界面 python高级 java集合 安装java环境 java中的接口 java判断是否为空 蓝牙运动耳机排行榜 雪地求生 rndis驱动下载 亚索刀光特效包 python输入数字 咪咕客户端下载 gilisoft 只狼鬼佛 编程语言实现模式 win10有几个版本 js倒计时 lol卡米尔 python缩进规则 ps从入门到精通
当前位置: 首页 > 学习教程  > 编程语言

解决k8s部署dashboard时一直处于Pending状态的问题

2020/10/8 18:17:03 文章标签:

部署dashboard时一直处于Pending状态搭建Dashboard时执行 kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.4/aio/deploy/recommended.yaml查看pod状态,一直报错Pending [rootmaster01 k8s]# kubectl get pods -n kubernetes-dashb…

部署dashboard时一直处于Pending状态

搭建Dashboard时执行
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.4/aio/deploy/recommended.yaml

查看pod状态,一直报错Pending

[root@master01 k8s]# kubectl get pods -n kubernetes-dashboard

NAME                                         READY   STATUS    RESTARTS   AGE
dashboard-metrics-scraper-6c9bfb459b-ldrfb   0/1     Pending   0          28m
kubernetes-dashboard-5947dc95db-n42cs        0/1     Pending   0          20m

查看pod的详细信息,发现报错调度错误:0/2 nodes are available: 2 node(s) didn’t match node selector

[root@master01 k8s]# kubectl describe pod kubernetes-dashboard-5947dc95db-n42cs -n kubernetes-dashboard
Name:               kubernetes-dashboard-5947dc95db-n42cs
Namespace:          kubernetes-dashboard
Priority:           0
PriorityClassName:  <none>
Node:               <none>
Labels:             k8s-app=kubernetes-dashboard
                    pod-template-hash=5947dc95db
Annotations:        <none>
Status:             Pending


Events:
  Type     Reason            Age                  From               Message
  ----     ------            ----                 ----               -------
  Warning  FailedScheduling  83s (x241 over 21m)  default-scheduler  0/2 nodes are available: 2 node(s) didn't match node selector.

原因:如果当前集群中没有一个node的label符合这个nodeSelector,就会报这个错误

解决方法:在yaml文件里面注释掉nodeSelector

在这里插入图片描述
在这里插入图片描述
注释掉以后重新启动dashboard还是报错,这次报错error

[root@master01 k8s]# kubectl get pods -n kubernetes-dashboard
NAME                                         READY   STATUS    RESTARTS   AGE
dashboard-metrics-scraper-7f44bd8d8b-d4cwl   1/1     Running   0          2m24s
kubernetes-dashboard-786df6b6b8-7pfdk        0/1     Error     1          2m24s

查看pod详细信息,报错:Back-off restarting failed container

[root@master01 k8s]# kubectl describe pod kubernetes-dashboard-786df6b6b8-7pfdk -n kubernetes-dashboard
Name:               kubernetes-dashboard-786df6b6b8-7pfdk
Namespace:          kubernetes-dashboard
Priority:           0
PriorityClassName:  <none>
Node:               192.168.245.210/192.168.245.210
Start Time:         Thu, 08 Oct 2020 17:30:40 +0800
Labels:             k8s-app=kubernetes-dashboard
                    pod-template-hash=786df6b6b8
Annotations:        <none>
Status:             Running
IP:                 172.17.75.2
Controlled By:      ReplicaSet/kubernetes-dashboard-786df6b6b8
Containers:
  kubernetes-dashboard:
    Container ID:  docker://4b2497125a5b8b09a00cf5496ead7752085e2879b33530fdf4693d3569c41a05
    Image:         kubernetesui/dashboard:v2.0.4
    Image ID:      docker-pullable://kubernetesui/dashboard@sha256:c557b14b678739c91cb5e7874f47dc6a2c160749aa0cb750217d94e10481b511
    Port:          8443/TCP
    Host Port:     0/TCP

Events:
  Type     Reason     Age                  From                      Message
  ----     ------     ----                 ----                      -------
  Normal   Scheduled  3m33s                default-scheduler         Successfully assigned kubernetes-dashboard/kubernetes-dashboard-786df6b6b8-7pfdk to 192.168.245.210
  Normal   Pulling    51s (x3 over 3m32s)  kubelet, 192.168.245.210  pulling image "kubernetesui/dashboard:v2.0.4"
  Normal   Pulled     40s (x3 over 2m13s)  kubelet, 192.168.245.210  Successfully pulled image "kubernetesui/dashboard:v2.0.4"
  Normal   Created    40s (x3 over 2m13s)  kubelet, 192.168.245.210  Created container
  Normal   Started    39s (x3 over 2m13s)  kubelet, 192.168.245.210  Started container
  Warning  BackOff    3s (x5 over 73s)     kubelet, 192.168.245.210  Back-off restarting failed container

解决方法:在yaml文件中注释总是拉取镜像的配置

在这里插入图片描述
验证pod启动成功

[root@master01 k8s]# kubectl get pods -n kubernetes-dashboard
NAME                                         READY   STATUS    RESTARTS   AGE
dashboard-metrics-scraper-7f44bd8d8b-pqs75   1/1     Running   0          7s
kubernetes-dashboard-849796f7fd-9kfnm        1/1     Running   0          7s

本文链接: http://www.dtmao.cc/news_show_250033.shtml

附件下载

相关教程

    暂无相关的数据...

共有条评论 网友评论

验证码: 看不清楚?