docker - 在Pod中获取 “ErrImageNeverPull”

标签 docker kubernetes kubectl minikube dockerhub

我正在使用minikube测试部署,并正在通过this链接

我要部署的 list 文件就像

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: webapp
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: webapp
    spec:
      containers:
      - name: webapp
        imagePullPolicy: Never # <-- here we go!
        image: sams
        ports:
        - containerPort: 80

然后当我尝试执行以下命令时输出
user@usesr:~/Downloads$ kubectl create -f mydeployment.yaml --validate=false

deployment "webapp" created

user@user:~/Downloads$ kubectl get deployments

NAME      DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
----     --------   -------   ----------   ---------   ----              
webapp    1         1         1            0           9s

user@user:~/Downloads$ kubectl get pods

NAME                     READY     STATUS              RESTARTS   AGE
----     --------   -------   ----------   ---------   ----              
webapp-5bf5bd94d-2xgs8   0/1       ErrImageNeverPull   0          21s

我什至试图通过从Docker-Hub中删除行imagePullPolicy: Neverdeployment.yml中提取图像,但是得到了同样的错误。谁能在这里帮助我找出问题所在和出了什么问题

根据评论更新了问题
kubectl describe pod $POD_NAME
Name:           webapp-5bf5bd94d-2xgs8
Namespace:      default
Node:           minikube/10.0.2.15
Start Time:     Fri, 31 May 2019 14:25:41 +0530
Labels:         app=webapp
            pod-template-hash=5bf5bd94d
Annotations:    <none>
Status:         Pending
IP:             172.17.0.4
Controlled By:  ReplicaSet/webapp-5bf5bd94d
Containers:
  webapp:
    Container ID:   
    Image:          sams
    Image ID:       
    Port:           80/TCP
    State:          Waiting
      Reason:       ErrImageNeverPull
    Ready:          False
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-wf82w (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             False 
  ContainersReady   False 
  PodScheduled      True 
Volumes:
  default-token-wf82w:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-wf82w
    Optional:    false
QoS Class:       BestEffort
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          18m                default-scheduler  Successfully assigned default/webapp-5bf5bd94d-2xgs8 to minikube
  Warning  ErrImageNeverPull  8m (x50 over 18m)  kubelet, minikube  Container image "sams" is not present with pull policy of Never
  Warning  Failed             3m (x73 over 18m)  kubelet, minikube  Error: ErrImageNeverPull    

docker images:

REPOSITORY                             TAG                 IMAGE ID            CREATED             SIZE
----------                             ---                 --------            -------             ----
<none>                                 <none>              723ce2b3d962        3 hours ago         1.91GB
bean_ben501/sams                       latest              c7c4a04713f4        4 hours ago         278MB
sams                                   latest              c7c4a04713f4        4 hours ago         278MB
sams                                   v1                  c7c4a04713f4        4 hours ago         278MB
<none>                                 <none>              b222da630bc3        4 hours ago         1.91GB
mcr.microsoft.com/dotnet/core/sdk      2.2-stretch         e4747ec2aaff        9 days ago          1.74GB
mcr.microsoft.com/dotnet/core/aspnet   2.2-stretch-slim    f6d51449c477        9 days ago          260MB

最佳答案

When using a single VM for Kubernetes, it’s useful to reuse Minikube’s built-in Docker daemon. Reusing the built-in daemon means you don’t have to build a Docker registry on your host machine and push the image into it. Instead, you can build inside the same Docker daemon as Minikube, which speeds up local experiments.



以下命令神奇
eval $(minikube docker-env)
对于imagePullPolicy: Never,图像必须位于minikube节点上。

This answer provide details

local-images-in minikube docker environment

关于docker - 在Pod中获取 “ErrImageNeverPull”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56392041/

相关文章:

docker - Gradle docker由于执行顺序而无法构建镜像

mongodb - 完成入口点脚本后停止容器

Kubernetes覆盖网络比较

python-3.x - Kubernetes Python 客户端连接问题

kubernetes - Kubernetes 中的命名空间和上下文有什么区别?

docker - 如何将 Docker Hub 镜像拉到 Google Cloud Run?

ubuntu - 如何修复 DigitalOcean 的 Ubuntu Docker 16.04 服务器上的主机名解析?

kubernetes - 查找 Kubernetes 搜索词

kubernetes - 从Kubernetes部署公开SCDF服务

kubernetes - Kubectl获取事件说没有资源