您的位置:首页 > 大数据 > 人工智能

使用kubernetes创建容器一直处于ContainerCreating状态的原因查找与解决

2017-02-05 13:34 531 查看
运行容器的时候,发现一直处于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-2150523991
10 Containers:
11   my-alpine:
12     Container ID:
13     Image:        alpine
14     Image ID:
15     Port:
16     Args:
17       ping
18       www.baidu.com
19     QoS Tier:
20       cpu:        BestEffort
21       memory:        BestEffort
22     State:        Waiting
23       Reason:        ContainerCreating
24     Ready:        False
25     Restart Count:    0
26     Environment Variables:
27 Conditions:
28   Type        Status
29   Ready     False
30 No volumes.
31 Events:
32   FirstSeen    LastSeen    Count    From            SubobjectPath    Type        Reason        Message
33   ---------    --------    -----    ----            -------------    --------    ------        -------
34   7m        7m        1    {default-scheduler }            Normal        Scheduled    Successfully assigned my-alpine-2150523991-knzcx to node-150
35   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-lmvv5
43 Namespace:    default
44 Node:        node-150/192.168.10.150
45 Start Time:    Sat, 19 Nov 2016 18:20:52 +0800
46 Labels:        pod-template-hash=2150523991,run=my-alpine
47 Status:        Pending
48 IP:
49 Controllers:    ReplicaSet/my-alpine-2150523991
50 Containers:
51   my-alpine:
52     Container ID:
53     Image:        alpine
54     Image ID:
55     Port:
56     Args:
57       ping
58       www.baidu.com
59     QoS Tier:
60       cpu:        BestEffort
61       memory:        BestEffort
62     State:        Waiting
63       Reason:        ContainerCreating
64     Ready:        False
65     Restart Count:    0
66     Environment Variables:
67 Conditions:
68   Type        Status
69   Ready     False
70 No volumes.
71 Events:
72   FirstSeen    LastSeen    Count    From            SubobjectPath    Type        Reason        Message
73   ---------    --------    -----    ----            -------------    --------    ------        -------
74   7m        7m        1    {default-scheduler }            Normal        Scheduled    Successfully assigned my-alpine-2150523991-lmvv5 to node-150
75   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

不难看出,无法访问到gcr.io
有如下解决办法:

FQ

修改hosts文件(这里我用的是“61.91.161.217 gcr.io”,但是可能会失效)

从其他源下载容器“pause:2.0”,然后打tag为“gcr.io/google_containers/pause:2.0”
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐