k8s(kubernetes)服务部署dashboard时出现ImagePullBackOff/CrashLoopBackOff解决办法
dashboard
General-purpose web UI for Kubernetes clusters
项目地址:https://gitcode.com/gh_mirrors/da/dashboard
免费下载资源
·
部署服务时镜像拉取过程中出现:ImagePullBackOff
kubectl describe pods kubernetes-dashboard-975499656-krwl7 -n kube-system
查看pod的详细情况
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 4m38s default-scheduler Successfully assigned kube-system/kubernetes-dashboard-975499656-krwl7 to k8s-node2
Normal Pulling 2m32s (x4 over 4m38s) kubelet, k8s-node2 Pulling image "k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.1"
Warning Failed 2m16s (x4 over 4m22s) kubelet, k8s-node2 Failed to pull image "k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.1": rpc error: code = Unknown desc = Error response from daemon: Get https://k8s.gcr.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
Warning Failed 2m16s (x4 over 4m22s) kubelet, k8s-node2 Error: ErrImagePull
Normal BackOff 112s (x6 over 4m22s) kubelet, k8s-node2 Back-off pulling image "k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.1"
Warning Failed 99s (x7 over 4m22s) kubelet, k8s-node2 Error: ImagePullBackOff
分析:这个拉取的国外的镜像源,是有点慢,网络不好的时候经常会出现这种情况,可以提前把需要的镜像下载好
解决办法:
更换国内镜像源,搜索需要下载的镜像
①编辑文件 /etc/docker/daemon.json 加入"registry-mirrors":["https://docker.mirrors.ustc.edu.cn"]
重载配置文件重启docker生效
systemctl daemon-reload
systemctl restart docker
②搜索需要的镜像,如:k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.1
③拉取指定镜像
④tag为配置文件中需要的镜像名k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.1
docker tag loveone/kubernetes-dashboard-amd64:v1.10.1 k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.1
完成后再试一次(注意最好每个节点都做这样的操作,因为调度器随机选择节点部署,简而言之是在被部署的节点上操作)
重新部署
①kubectl delete -f kubernetes-dashboard.yaml
,
②kubectl apply -f kubernetes-dashboard.yaml
或者 kubectl create -f kubernetes-dashboard.yaml --save-config
出现如下报错
kubectl logs kubernetes-dashboard-975499656-xlx5b -n kube-system
- 查看pod日志如下
Error from server: Get https://192.168.40.131:10250/containerLogs/kube-system/kubernetes-dashboard-975499656-xlx5b/kubernetes-dashboard: dial tcp 192.168.40.131:10250: connect: no route to host - 分析:由此可见,部署服务时访问节点131的10250端口连接被拒绝,推测可能是防火墙的原因
- 解决办法:
①查看服务端口是否被占用,!是否已经启起来了;
可以看到,端口启动正常;
②telnet测试一下端口(我这里是master机器上测试的)
果然不通
③查看节点1的防火墙状态
果然是防火墙的原因
再试端口就通了
重新部署试试
成功
GitHub 加速计划 / da / dashboard
14.17 K
4.13 K
下载
General-purpose web UI for Kubernetes clusters
最近提交(Master分支:3 个月前 )
9a476333
Bumps [jest-preset-angular](https://github.com/thymikee/jest-preset-angular) from 14.2.0 to 14.2.2.
- [Release notes](https://github.com/thymikee/jest-preset-angular/releases)
- [Changelog](https://github.com/thymikee/jest-preset-angular/blob/main/CHANGELOG.md)
- [Commits](https://github.com/thymikee/jest-preset-angular/compare/v14.2.0...v14.2.2)
---
updated-dependencies:
- dependency-name: jest-preset-angular
dependency-type: direct:development
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 3 个月前
11b7e82e
Bumps [cypress](https://github.com/cypress-io/cypress) from 13.13.1 to 13.13.2.
- [Release notes](https://github.com/cypress-io/cypress/releases)
- [Changelog](https://github.com/cypress-io/cypress/blob/develop/CHANGELOG.md)
- [Commits](https://github.com/cypress-io/cypress/compare/v13.13.1...v13.13.2)
---
updated-dependencies:
- dependency-name: cypress
dependency-type: direct:development
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 3 个月前
更多推荐
已为社区贡献1条内容
所有评论(0)