docker - 使用kubernetes创建容器一直处于ContainerCreating状态
習慣沉默
習慣沉默 2017-04-27 09:03:06
0
3
1701

运行容器命令:

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

查看pods状态

[root@master-149 ~]# kubectl get pods
NAME                         READY     STATUS              RESTARTS   AGE
my-alpine-2150523991-knzcx   0/1       ContainerCreating   0          6m
my-alpine-2150523991-lmvv5   0/1       ContainerCreating   0          6m
習慣沉默
習慣沉默

répondre à tous(3)
伊谢尔伦

Utilisez kubectl décrire pod my-alpine-2150523991-knzcx pour visualiser les événements pendant le processus de création du pod, vous pourriez avoir des surprises

小葫芦

J'ai trouvé la solution en fonction de la réponse au 1er étage :

Exécutez la commande suivante :

[root@master-149 ~]# kubectl describe pod my-alpine
Name:        my-alpine-2150523991-knzcx
Namespace:    default
Node:        node-150/192.168.10.150
Start Time:    Sat, 19 Nov 2016 18:20:52 +0800
Labels:        pod-template-hash=2150523991,run=my-alpine
Status:        Pending
IP:        
Controllers:    ReplicaSet/my-alpine-2150523991
Containers:
  my-alpine:
    Container ID:    
    Image:        alpine
    Image ID:        
    Port:        
    Args:
      ping
      www.baidu.com
    QoS Tier:
      cpu:        BestEffort
      memory:        BestEffort
    State:        Waiting
      Reason:        ContainerCreating
    Ready:        False
    Restart Count:    0
    Environment Variables:
Conditions:
  Type        Status
  Ready     False 
No volumes.
Events:
  FirstSeen    LastSeen    Count    From            SubobjectPath    Type        Reason        Message
  ---------    --------    -----    ----            -------------    --------    ------        -------
  7m        7m        1    {default-scheduler }            Normal        Scheduled    Successfully assigned my-alpine-2150523991-knzcx to node-150
  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)"

  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)"

  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\""


Name:        my-alpine-2150523991-lmvv5
Namespace:    default
Node:        node-150/192.168.10.150
Start Time:    Sat, 19 Nov 2016 18:20:52 +0800
Labels:        pod-template-hash=2150523991,run=my-alpine
Status:        Pending
IP:        
Controllers:    ReplicaSet/my-alpine-2150523991
Containers:
  my-alpine:
    Container ID:    
    Image:        alpine
    Image ID:        
    Port:        
    Args:
      ping
      www.baidu.com
    QoS Tier:
      cpu:        BestEffort
      memory:        BestEffort
    State:        Waiting
      Reason:        ContainerCreating
    Ready:        False
    Restart Count:    0
    Environment Variables:
Conditions:
  Type        Status
  Ready     False 
No volumes.
Events:
  FirstSeen    LastSeen    Count    From            SubobjectPath    Type        Reason        Message
  ---------    --------    -----    ----            -------------    --------    ------        -------
  7m        7m        1    {default-scheduler }            Normal        Scheduled    Successfully assigned my-alpine-2150523991-lmvv5 to node-150
  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)"

  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\""

Parmi eux :

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)

Il n'est pas difficile de voir que gcr.io n'est pas accessible
Il existe des solutions suivantes :

  1. Grimper le mur

  2. Modifier le fichier hosts

  3. Téléchargez le conteneur "pause:2.0" à partir d'autres sources, puis marquez-le comme "gcr.io/google_containers/pause:2.0"

阿神

gcr.io est bloqué, vous pouvez ajouter un paramètre kubelet à --pod-infra-container-image pour préciser un miroir domestique.

Nous avons déplacé une image vers registry.aliyuncs.com/archon/pause-amd64:3.0 et vous pouvez l'utiliser.

Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!