Kubernetes在minikube上报告了podPullBackOff

时间:2018-03-07 14:22:40

标签: kubernetes minikube

我在minikube VM中构建了一个docker镜像。但是我不明白为什么Kubernetes找不到它?

minikube ssh

$ docker images
REPOSITORY                                     TAG                 IMAGE ID            CREATED             SIZE
diyapploopback                                 latest              9590c4dc2ed1        2 hours ago         842MB

如果我描述pod:

kubectl describe pods abcxyz12-6b4d85894-fhb2p
Name:       abcxyz12-6b4d85894-fhb2p
Namespace:  diyclientapps
Node:       minikube/192.168.99.100
Start Time: Wed, 07 Mar 2018 13:49:51 +0000
Labels:     appId=abcxyz12
        pod-template-hash=260841450
Annotations:    <none>
Status:     Pending
IP:     172.17.0.6
Controllers:    <none>
Containers:
  nginx:
    Container ID:   
    Image:      diyapploopback:latest
    Image ID:       
    Port:       80/TCP
    State:      Waiting
      Reason:       ImagePullBackOff
    Ready:      False
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-c62fx (ro)
  mariadb:
    Container ID:   docker://fe09e08f98a9f972f2d086b56b55982e96772a2714ad3b4c2adf4f2f06c2986a
    Image:      mariadb:10.3
    Image ID:       docker-pullable://mariadb@sha256:8d4b8fd12c86f343b19e29d0fdd0c63a7aa81d4c2335317085ac973a4782c1f5
    Port:       
    State:      Running
      Started:      Wed, 07 Mar 2018 14:21:00 +0000
    Last State:     Terminated
      Reason:       Completed
      Exit Code:    0
      Started:      Wed, 07 Mar 2018 13:49:54 +0000
      Finished:     Wed, 07 Mar 2018 14:18:43 +0000
    Ready:      True
    Restart Count:  1
    Environment:
      MYSQL_ROOT_PASSWORD:  passwordTempXyz
    Mounts:
      /var/lib/mysql from mysql-persistent-storage (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-c62fx (ro)
Conditions:
  Type      Status
  Initialized   True 
  Ready     False 
  PodScheduled  True 
Volumes:
  mysql-persistent-storage:
    Type:   PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  abcxyz12
    ReadOnly:   false
  default-token-c62fx:
    Type:   Secret (a volume populated by a Secret)
    SecretName: default-token-c62fx
    Optional:   false
QoS Class:  BestEffort
Node-Selectors: <none>
Tolerations:    <none>
Events:
  FirstSeen LastSeen    Count   From            SubObjectPath           Type        Reason          Message
  --------- --------    -----   ----            -------------           --------    ------          -------
  31m       31m     1   default-scheduler                   Normal      Scheduled       Successfully assigned abcxyz12-6b4d85894-fhb2p to minikube
  31m       31m     1   kubelet, minikube                   Normal      SuccessfulMountVolume   MountVolume.SetUp succeeded for volume "default-token-c62fx" 
  31m       31m     1   kubelet, minikube                   Normal      SuccessfulMountVolume   MountVolume.SetUp succeeded for volume "pvc-689f3067-220e-11e8-a244-0800279a9a04" 
  31m       31m     1   kubelet, minikube   spec.containers{mariadb}    Normal      Pulled          Container image "mariadb:10.3" already present on machine
  31m       31m     1   kubelet, minikube   spec.containers{mariadb}    Normal      Created         Created container
  31m       31m     1   kubelet, minikube   spec.containers{mariadb}    Normal      Started         Started container
  31m       30m     3   kubelet, minikube   spec.containers{nginx}      Warning     Failed          Failed to pull image "diyapploopback:latest": rpc error: code = Unknown desc = Error response from daemon: pull access denied for diyapploopback, repository does not exist or may require 'docker login'
  31m       30m     3   kubelet, minikube   spec.containers{nginx}      Warning     Failed          Error: ErrImagePull
  31m       29m     4   kubelet, minikube   spec.containers{nginx}      Normal      Pulling         pulling image "diyapploopback:latest"
  31m       16m     63  kubelet, minikube   spec.containers{nginx}      Normal      BackOff         Back-off pulling image "diyapploopback:latest"
  31m       6m      105 kubelet, minikube   spec.containers{nginx}      Warning     Failed          Error: ImagePullBackOff
  21s       21s     1   kubelet, minikube                   Normal      SuccessfulMountVolume   MountVolume.SetUp succeeded for volume "pvc-689f3067-220e-11e8-a244-0800279a9a04" 
  20s       20s     1   kubelet, minikube                   Normal      SuccessfulMountVolume   MountVolume.SetUp succeeded for volume "default-token-c62fx" 
  20s       20s     1   kubelet, minikube                   Normal      SandboxChanged      Pod sandbox changed, it will be killed and re-created.
  17s       17s     1   kubelet, minikube   spec.containers{nginx}      Warning     Failed          Failed to pull image "diyapploopback:latest": rpc error: code = Unknown desc = Error response from daemon: pull access denied for diyapploopback, repository does not exist or may require 'docker login'
  17s       17s     1   kubelet, minikube   spec.containers{nginx}      Warning     Failed          Error: ErrImagePull
  17s       17s     1   kubelet, minikube   spec.containers{mariadb}    Normal      Pulled          Container image "mariadb:10.3" already present on machine
  17s       17s     1   kubelet, minikube   spec.containers{mariadb}    Normal      Created         Created container
  16s       16s     1   kubelet, minikube   spec.containers{mariadb}    Normal      Started         Started container
  16s       15s     2   kubelet, minikube   spec.containers{nginx}      Normal      BackOff         Back-off pulling image "diyapploopback:latest"
  16s       15s     2   kubelet, minikube   spec.containers{nginx}      Warning     Failed          Error: ImagePullBackOff
  19s       1s      2   kubelet, minikube   spec.containers{nginx}      Normal      Pulling         pulling image "diyapploopback:latest"

似乎我可以直接运行它(仅用于调试/诊断目的..): kubectl run abcxyz123 --image=diyapploopback --image-pull-policy=Never

如果我描述上面的部署/容器,我得到:

Name:       abcxyz123-6749977548-stvsm
Namespace:  diyclientapps
Node:       minikube/192.168.99.100
Start Time: Wed, 07 Mar 2018 14:26:33 +0000
Labels:     pod-template-hash=2305533104
        run=abcxyz123
Annotations:    <none>
Status:     Running
IP:     172.17.0.9
Controllers:    <none>
Containers:
  abcxyz123:
    Container ID:   docker://c9b71667feba21ef259a395c9b8504e3e4968e5b9b35a191963f0576d0631d11
    Image:      diyapploopback
    Image ID:       docker://sha256:9590c4dc2ed16cb70a21c3385b7e0519ad0b1fece79e343a19337131600aa866
    Port:       
    State:      Waiting
      Reason:       CrashLoopBackOff
    Last State:     Terminated
      Reason:       Error
      Exit Code:    1
      Started:      Wed, 07 Mar 2018 14:42:45 +0000
      Finished:     Wed, 07 Mar 2018 14:42:48 +0000
    Ready:      False
    Restart Count:  8
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-c62fx (ro)
Conditions:
  Type      Status
  Initialized   True 
  Ready     False 
  PodScheduled  True 
Volumes:
  default-token-c62fx:
    Type:   Secret (a volume populated by a Secret)
    SecretName: default-token-c62fx
    Optional:   false
QoS Class:  BestEffort
Node-Selectors: <none>
Tolerations:    <none>
Events:
  FirstSeen LastSeen    Count   From            SubObjectPath           Type        Reason          Message
  --------- --------    -----   ----            -------------           --------    ------          -------
  17m       17m     1   default-scheduler                   Normal      Scheduled       Successfully assigned abcxyz123-6749977548-stvsm to minikube
  17m       17m     1   kubelet, minikube                   Normal      SuccessfulMountVolume   MountVolume.SetUp succeeded for volume "default-token-c62fx" 
  17m       15m     5   kubelet, minikube   spec.containers{abcxyz123}  Normal      Pulled          Container image "diyapploopback" already present on machine
  17m       15m     5   kubelet, minikube   spec.containers{abcxyz123}  Normal      Created         Created container
  17m       15m     5   kubelet, minikube   spec.containers{abcxyz123}  Normal      Started         Started container
  16m       1m      66  kubelet, minikube   spec.containers{abcxyz123}  Warning     BackOff         Back-off restarting failed container

1 个答案:

答案 0 :(得分:2)

TerminalSerialNo    IMEI    Site-Ref
77EC0067C8A1BA6462FCA25F8B1DFBE289F6A3EE    null    SIT-3
01B406234550B1A688000050BF7A60E2    null    SIT-3
19B32E9399CB51FACF858E126F9C7684578A8BAC    null    SIT-7

以上在部署中的图像配置中不存在(并且需要...)