代码之家  ›  专栏  ›  技术社区  ›  Chris G.

如何在上调试ImagePullBackOffgcr.io公司

  •  0
  • Chris G.  · 技术社区  · 6 年前

    更新:如果我使用googlekubernetes引擎站点界面和deploy按钮,也是一样的。

    更新:从查看此更新群集,不起作用: Kubernetes pods failing on "Pod sandbox changed, it will be killed and re-created"

    gcloud auth configure-docker
    docker pull kennethreitz/httpbin
    docker tag kennethreitz/httpbin:latest gcr.io/<proj-id>/images/httpbin:v1.0
    docker push gcr.io/<proj-id>/images/httpbin:v1.0
    kubectl run test --image=gcr.io/<proj-id>/images/httpbin:v1.0
    

    然后我得到一张图片:

    kubectl describe pod test-5f447f48f4-kcpg9
    Name:           test-5f447f48f4-kcpg9
    Namespace:      default
    Node:           <proj-id>-cluster-default-pool-f398e01b-5kmb/10.132.0.2
    Start Time:     Tue, 28 Aug 2018 09:08:43 +0200
    Labels:         pod-template-hash=1900390490
                    run=test
    Annotations:    kubernetes.io/limit-ranger=LimitRanger plugin set: cpu request for container test
    Status:         Pending
    IP:             10.16.1.46
    Controlled By:  ReplicaSet/test-5f447f48f4
    Containers:
      test:
        Container ID:   
        Image:          gcr.io/<proj-id>/images/httpbin:v1.0
        Image ID:       
        Port:           <none>
        State:          Waiting
          Reason:       ImagePullBackOff
        Ready:          False
        Restart Count:  0
        Requests:
          cpu:        100m
        Environment:  <none>
        Mounts:
          /var/run/secrets/kubernetes.io/serviceaccount from default-token-9mcms (ro)
    Conditions:
      Type           Status
      Initialized    True 
      Ready          False 
      PodScheduled   True 
    Volumes:
      default-token-9mcms:
        Type:        Secret (a volume populated by a Secret)
        SecretName:  default-token-9mcms
        Optional:    false
    QoS Class:       Burstable
    Node-Selectors:  <none>
    Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                     node.kubernetes.io/unreachable:NoExecute for 300s
    Events:
      Type     Reason                 Age                From                                                   Message
      ----     ------                 ----               ----                                                   -------
      Normal   Scheduled              5m                 default-scheduler                                      Successfully assigned test-5f447f48f4-kcpg9 to <proj-id>-cluster-default-pool-f398e01b-5kmb
      Normal   SuccessfulMountVolume  5m                 kubelet, <proj-id>-cluster-default-pool-f398e01b-5kmb  MountVolume.SetUp succeeded for volume "default-token-9mcms"
      Normal   SandboxChanged         5m (x3 over 5m)    kubelet, <proj-id>-cluster-default-pool-f398e01b-5kmb  Pod sandbox changed, it will be killed and re-created.
      Normal   BackOff                5m (x6 over 5m)    kubelet, <proj-id>-cluster-default-pool-f398e01b-5kmb  Back-off pulling image "gcr.io/<proj-id>/images/httpbin:v1.0"
      Normal   Pulling                4m (x3 over 5m)    kubelet, <proj-id>-cluster-default-pool-f398e01b-5kmb  pulling image "gcr.io/<proj-id>/images/httpbin:v1.0"
      Warning  Failed                 4m (x3 over 5m)    kubelet, <proj-id>-cluster-default-pool-f398e01b-5kmb  Failed to pull image "gcr.io/<proj-id>/images/httpbin:v1.0": rpc error: code = Unknown desc = Error response from daemon: repository gcr.io/<proj-id>/images/httpbin not found: does not exist or no pull access
      Warning  Failed                 4m (x3 over 5m)    kubelet, <proj-id>-cluster-default-pool-f398e01b-5kmb  Error: ErrImagePull
      Warning  Failed                 31s (x23 over 5m)  kubelet, <proj-id>-cluster-default-pool-f398e01b-5kmb  Error: ImagePullBackOff
    

    在云壳中: docker images

    更新:我可以在浏览器控制台中看到图像( https://console.cloud.google.com/gcr/images/projId/ ),如果复制路径,它与下面的路径相同-只是使用另一个项目id。

    kubectl run aName——图片=gcr.io/projectid/myimages/myimage:v1.0版

    ImagePullBackOff
    

    kubectl描述pod aName。。。

    Failed to pull image "myimages/myimage:v1.0": rpc error: code = Unknown desc = Error response from daemon: repository myimages/myimage not found: does not exist or no pull access
    

    "or no pull access" 但我该怎么解决呢?

    1 回复  |  直到 6 年前
        1
  •  4
  •   ahmet alp balkan    6 年前

    这个 myimages/myimage 格式表明您正在使用Docker Hub。如果是这样,您可能需要使用图像拉取密钥对Docker Hub进行身份验证( https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/#create-a-secret-in-the-cluster-that-holds-your-authorization-token ).

    gcr.io/* ),GKE节点将已经可以访问与cluster相同的GCP项目中的GCR图像,而无需执行任何操作。(但是,如果有人创建的GKE集群或节点池小于默认值 --scopes ,例如省略 storage-ro

    请按照 https://cloud.google.com/kubernetes-engine/docs/tutorials/hello-app 收件人:

    1. 创建群集
    2. 从源代码生成映像
    3. 推到GCR