博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
使用kubernetes创建容器一直处于ContainerCreating状态的原因查找与解决
阅读量:6733 次
发布时间:2019-06-25

本文共 5729 字,大约阅读时间需要 19 分钟。

运行容器的时候,发现一直处于ContainerCreating状态,悲了个催,刚入手就遇到了点麻烦,下面来讲讲如何查找问题及解决的

运行容器命令:

[root@master-149 ~]# kubectl run my-alpine --image=alpine --replicas=2 ping www.baidu.com
View Code

 

查看pods状态

1 [root@master-149 ~]# kubectl get pods2 NAME                         READY     STATUS              RESTARTS   AGE3 my-alpine-2150523991-knzcx   0/1       ContainerCreating   0          6m4 my-alpine-2150523991-lmvv5   0/1       ContainerCreating   0          6m
View Code

 

一直处于ContainerCreating状态,开始查找原因

执行如下命令:

1 [root@master-149 ~]# kubectl describe pod my-alpine 2 Name:        my-alpine-2150523991-knzcx 3 Namespace:    default 4 Node:        node-150/192.168.10.150 5 Start Time:    Sat, 19 Nov 2016 18:20:52 +0800 6 Labels:        pod-template-hash=2150523991,run=my-alpine 7 Status:        Pending 8 IP:         9 Controllers:    ReplicaSet/my-alpine-215052399110 Containers:11   my-alpine:12     Container ID:    13     Image:        alpine14     Image ID:        15     Port:        16     Args:17       ping18       www.baidu.com19     QoS Tier:20       cpu:        BestEffort21       memory:        BestEffort22     State:        Waiting23       Reason:        ContainerCreating24     Ready:        False25     Restart Count:    026     Environment Variables:27 Conditions:28   Type        Status29   Ready     False 30 No volumes.31 Events:32   FirstSeen    LastSeen    Count    From            SubobjectPath    Type        Reason        Message33   ---------    --------    -----    ----            -------------    --------    ------        -------34   7m        7m        1    {default-scheduler }            Normal        Scheduled    Successfully assigned my-alpine-2150523991-knzcx to node-15035   6m        6m        1    {kubelet node-150}            Warning        FailedSync    Error syncing pod, skipping: failed to "StartContainer" for "POD" with ErrImagePull: "image pull failed for gcr.io/google_containers/pause:2.0, this may be because there are no credentials on this request.  details: (unable to ping registry endpoint https://gcr.io/v0/\nv2 ping attempt failed with error: Get https://gcr.io/v2/: dial tcp 64.233.189.82:443: getsockopt: connection refused\n v1 ping attempt failed with error: Get https://gcr.io/v1/_ping: dial tcp 64.233.189.82:443: getsockopt: connection refused)"36 37   4m    47s    3    {kubelet node-150}        Warning    FailedSync    Error syncing pod, skipping: failed to "StartContainer" for "POD" with ErrImagePull: "image pull failed for gcr.io/google_containers/pause:2.0, this may be because there are no credentials on this request.  details: (unable to ping registry endpoint https://gcr.io/v0/\nv2 ping attempt failed with error: Get https://gcr.io/v2/: dial tcp 74.125.204.82:443: getsockopt: connection refused\n v1 ping attempt failed with error: Get https://gcr.io/v1/_ping: dial tcp 74.125.204.82:443: getsockopt: connection refused)"38 39   4m    8s    6    {kubelet node-150}        Warning    FailedSync    Error syncing pod, skipping: failed to "StartContainer" for "POD" with ImagePullBackOff: "Back-off pulling image \"gcr.io/google_containers/pause:2.0\""40 41 42 Name:        my-alpine-2150523991-lmvv543 Namespace:    default44 Node:        node-150/192.168.10.15045 Start Time:    Sat, 19 Nov 2016 18:20:52 +080046 Labels:        pod-template-hash=2150523991,run=my-alpine47 Status:        Pending48 IP:        49 Controllers:    ReplicaSet/my-alpine-215052399150 Containers:51   my-alpine:52     Container ID:    53     Image:        alpine54     Image ID:        55     Port:        56     Args:57       ping58       www.baidu.com59     QoS Tier:60       cpu:        BestEffort61       memory:        BestEffort62     State:        Waiting63       Reason:        ContainerCreating64     Ready:        False65     Restart Count:    066     Environment Variables:67 Conditions:68   Type        Status69   Ready     False 70 No volumes.71 Events:72   FirstSeen    LastSeen    Count    From            SubobjectPath    Type        Reason        Message73   ---------    --------    -----    ----            -------------    --------    ------        -------74   7m        7m        1    {default-scheduler }            Normal        Scheduled    Successfully assigned my-alpine-2150523991-lmvv5 to node-15075   5m        1m        3    {kubelet node-150}            Warning        FailedSync    Error syncing pod, skipping: failed to "StartContainer" for "POD" with ErrImagePull: "image pull failed for gcr.io/google_containers/pause:2.0, this may be because there are no credentials on this request.  details: (unable to ping registry endpoint https://gcr.io/v0/\nv2 ping attempt failed with error: Get https://gcr.io/v2/: dial tcp 74.125.204.82:443: getsockopt: connection refused\n v1 ping attempt failed with error: Get https://gcr.io/v1/_ping: dial tcp 74.125.204.82:443: getsockopt: connection refused)"76 77   3m    1m    4    {kubelet node-150}        Warning    FailedSync    Error syncing pod, skipping: failed to "StartContainer" for "POD" with ImagePullBackOff: "Back-off pulling image \"gcr.io/google_containers/pause:2.0\""78 其中:79 80 Error syncing pod, skipping: failed to "StartContainer" for "POD" with ErrImagePull: "image pull failed for gcr.io/google_containers/pause:2.0, this may be because there are no credentials on this request.  details: (unable to ping registry endpoint https://gcr.io/v0/\nv2 ping attempt failed with error: Get https://gcr.io/v2/: dial tcp 74.125.204.82:443: getsockopt: connection refused\n v1 ping attempt failed with error: Get https://gcr.io/v1/_ping: dial tcp 74.125.204.82:443: getsockopt: connection refused)
View Code

 

不难看出,

有如下解决办法:

    1. FQ
    2. 修改hosts文件(这里我用的是“61.91.161.217  gcr.io”,但是可能会失效)
    3. 从其他源下载容器“pause:2.0”,然后打tag为“

转载地址:http://xafqo.baihongyu.com/

你可能感兴趣的文章
【luogu 2529】【SHOI 2001】击鼓传花
查看>>
C# PDF 全攻略
查看>>
android第二次作业
查看>>
java流类基础练习。
查看>>
kill-9 kill-3
查看>>
登陆密码加密
查看>>
MVC过滤器
查看>>
5天玩转C#并行和多线程编程 —— 第四天 Task进阶
查看>>
《你的灯亮着吗》——读后总结
查看>>
LoadRunner FAQ2
查看>>
Sql Server之旅——第五站 确实不得不说的DBCC命令
查看>>
用适配器模式处理复杂的UITableView中cell的业务逻辑
查看>>
HOG特征-理解篇
查看>>
结构类模式(四):装饰(Decorator)
查看>>
java面试题
查看>>
使用两个 Windows 窗体 DataGridView 控件创建一个主/从窗体
查看>>
111、Android 高仿 频道管理---(可以拖动的GridView)附源码DEMO (转载)
查看>>
l2正则化
查看>>
Atitit 视图状态ViewState)的原理与管理
查看>>
067 Flume协作框架
查看>>