码迷,mamicode.com
首页 > Web开发 > 详细

kubernetes常见问题(一)

时间:2019-07-09 13:59:23      阅读:343      评论:0      收藏:0      [点我收藏+]

标签:server   containe   pull   ber   -o   出错   dns解析   ror   run   

创建pod时提示错误

如果pod出错时会显示如下两种提示

[root@master ~]#kubectl get pods
NAME                         READY   STATUS             RESTARTS   AGE
net-test1-7c9c4b94d6-5mddl   1/1     Running            0          2m41s
net-test1-7c9c4b94d6-xk8jp   0/1     ImagePullBackOff   0          5s
[root@master ~]#kubectl get pods
NAME                         READY   STATUS         RESTARTS   AGE
net-test1-7c9c4b94d6-5mddl   1/1     Running        0          2m39s
net-test1-7c9c4b94d6-xk8jp   0/1     ErrImagePull   0          3s

排查问题原因

检查pod的日志,发现是无法下载pod的镜像

[root@master ~]#kubectl logs net-test1-7c9c4b94d6-xk8jp 
Error from server (BadRequest): container "net-test1" in pod "net-test1-7c9c4b94d6-xk8jp" is waiting to start: trying and failing to pull image

查看出问题的pod处于哪个节点之上,发现在node1节点上

[root@master ~]#kubectl get pods -o wide 
NAME                         READY   STATUS             RESTARTS   AGE   IP          NODE    NOMINATED NODE   R
net-test1-7c9c4b94d6-xk8jp   0/1     ImagePullBackOff   0          13s   10.10.1.7   node1   <none>           <
net-test1-7c9c4b94d6-5mddl   1/1     Running            0          14m   10.10.2.2   node2   <none>

在node1节点查看是否可以手动下载镜像,发现已经无法下载

[root@node1 ~]#docker pull alpine
Using default tag: latest
Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on 127.0.0.53:53: server misbehaving

检查node1节点是否能够网络通讯,发现无法进行名称解析

[root@node1 ~]#ping www.baidu.com
ping: www.baidu.com: Temporary failure in name resolution

解决问题

修改该节点的DNS,当前主机为ubuntu系统

[root@node1 ~]#vim /etc/systemd/resolved.conf 
#取消这一行注释,加入DNS解析地址
[Resolve]
DNS=8.8.8.8

在主节点上查看

[root@master ~]#kubectl get pods
NAME                         READY   STATUS    RESTARTS   AGE
net-test1-7c9c4b94d6-5mddl   1/1     Running   0          5m44s
net-test1-7c9c4b94d6-xk8jp   1/1     Running   0          3m8s

kubernetes常见问题(一)

标签:server   containe   pull   ber   -o   出错   dns解析   ror   run   

原文地址:https://blog.51cto.com/14163901/2418403

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!