简体   繁体   English

在 minikube 上部署时出现 ImagePulloff 错误

[英]ImagePulloff error while deploying on minikube

Hey there so I was trying to deploy my first and simple webapp with no database on minikube but this Imagepulloff error keeps coming in the pod.嘿,所以我试图在 minikube 上部署我的第一个简单的 web 应用程序,但这个 Imagepulloff 错误不断出现在 pod 中。 Yes I have checked the name of Image,tag several times;是的,我已经检查了几次 Image,tag 的名称; Here are the logs and yml files.这是日志和 yml 文件。

Namespace:        default
Priority:         0
Service Account:  default
Labels:           app=nodeapp1
                pod-template-hash=589c6bd468        
Annotations:      <none>
Status:           Pending
Controlled By:  ReplicaSet/nodeapp1-deployment-589c6bd468
Containers:
nodeserver:
  Container ID:
  Image:          ayushftw/nodeapp1:latest
  Image ID:
  Port:           3000/TCP
  Host Port:      0/TCP
  State:          Waiting
    Reason:       ErrImagePull
  Ready:          False
  Restart Count:  0
  Environment:    <none>
  Mounts:
    /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-k6mkb (ro)
Conditions:
Type              Status
Initialized       True
Ready             False
ContainersReady   False
PodScheduled      True
Volumes:
kube-api-access-k6mkb:
  Type:                    Projected (a volume that contains injected data from multiple sources)
  TokenExpirationSeconds:  3607
  ConfigMapOptional:       <nil>
  DownwardAPI:             true
Node-Selectors:              <none>
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
Events:
Type     Reason     Age   From               Message
----     ------     ----  ----               -------
Normal   Scheduled  2m3s  default-scheduler  Successfully assigned default/nodeapp1-deployment-589c6bd468-5lg2n to minikube
Normal   Pulling    2m2s  kubelet            Pulling image "ayushftw/nodeapp1:latest"
Warning  Failed     3s    kubelet            Failed to pull image "ayushftw/nodeapp1:latest": rpc error: code = Unknown desc = context deadline exceeded
Warning  Failed     3s    kubelet            Error: ErrImagePull
Normal   BackOff    2s    kubelet            Back-off pulling image "ayushftw/nodeapp1:latest"
Warning  Failed     2s    kubelet            Error: ImagePullBackOff

deployment.yml file部署.yml 文件

apiVersion: apps/v1

kind: Deployment

metadata:

  name: nodeapp1-deployment

  labels:

    app: nodeapp1

spec:

  replicas: 1

  selector:

    matchLabels:

      app: nodeapp1

  template:

    metadata:

      labels:

        app: nodeapp1

    spec:

      containers:

      - name: nodeserver

        image: ayushftw/nodeapp1:latest

        ports:

        - containerPort: 3000

service.yml fie service.yml 文件

apiVersion: v1
kind: Service
metadata:
  name: nodeapp1-service
spec:
  selector:
    app: nodeapp1
  type: LoadBalancer
  ports:
    - protocol: TCP
      port: 3000
      targetPort: 3000
      nodePort: 31011

Please Help If anybody knows anything about this.如果有人对此有所了解,请提供帮助。

It seems to be an issue with the ability to reach container registry or registry in use for your images.访问容器注册表或用于图像的注册表的能力似乎是一个问题。 Can you try to pull the image manually from the node?您可以尝试从节点手动拉取图像吗?

I think your internet connection is slow.我认为您的互联网连接速度很慢。 The timeout to pull an image is 120 seconds, so kubectl could not pull the image in under 120 seconds.拉取镜像的超时时间为120秒,因此 kubectl 无法在120秒内拉取镜像。

First, pull the image via Docker首先,通过Docker拉取镜像

docker image pull ayushftw/nodeapp1:latest

Then load the downloaded image to minikube然后将下载的镜像加载到minikube

minikube image load ayushftw/nodeapp1:latest

And then everything will work because now kubectl will use the image that is stored locally.然后一切都会工作,因为现在 kubectl 将使用本地存储的图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM