简体   繁体   English

图像存在,但出现错误 Init:ErrImageNeverPull 容器图像不存在,拉取策略为 Never

[英]Image exists but i get an error Init:ErrImageNeverPull Container image is not present with pull policy of Never

I am deploying an app on k3s with containerd (not docker) am trying to deploy a local image the image exists but the given error said image doesn't我正在使用 containerd(不是 docker)在 k3s 上部署一个应用程序,我正在尝试部署一个本地图像,该图像存在,但给定的错误说图像不存在


docker.io/kubernetesui/metrics-scraper            v1.0.8              115053965e86b       19.7MB

**docker.io/library/laravel-example-project-fpm     latest**            ac83c8e9c86fd       378MB

docker.io/library/laravel-example-project-nginx   latest              6403f5d7120c6       24.2MB
rn-manager             v1.1.0              6a6ea3dbf71b9       116MB
docker.io/monachus/rancher-demo                   latest              65053fcc5f37a       7.01MB
docker.io/rancher/klipper-lb                      v0.3.5              dbd43b6716a08       3.33MB
docker.io/rancher/local-path-provisioner          v0.0.21             fb9b574e03c34       11.4MB
docker.io/rancher/mirrored-coredns-coredns        1.9.1               99376d8f35e0a       14.1MB
docker.io/rancher/mirrored-library-traefik        2.6.2               72463d8000a35       30.3MB
docker.io/rancher/mirrored-metrics-server         v0.5.2              f73640fb50619       26MB
docker.io/rancher/mirrored-pause                  3.6                 6270bb605e12e       301kB
root@u-server-master:~# 


kubectl describe pod laravel-example-project-5597cdcc97-bv6fs

kubectl describe pod laravel-example-project-5597cdcc97-bv6fs

Events:
  Type     Reason             Age                    From               Message
  ----     ------             ----                   ----               -------
  Normal   Scheduled          45m                    default-scheduler  Successfully assigned default/laravel-example-project-5597cdcc97-bv6fs to zakham
  Warning  Failed             42m (x12 over 45m)     kubelet            Error: ErrImageNeverPull
  Warning  ErrImageNeverPull  4m57s (x187 over 45m)  kubelet            Container image "**laravel-example-project-fpm:latest**" is not present with pull policy of Never


kubectl get pods

laravel-example-project-5597cdcc97-26scj........ 0/2...........**Init:ErrImageNeverPull**.......0................ 26m

SOLVED i am using a local image with containerd i dont need to pull it, i solved it by specifing the node name nodeName because i noticed that when the pod is scheduled to the master node it run without error, so i specified that nodeName in the deployment解决我正在使用带有容器的本地映像我不需要拉它,我通过指定节点名称 nodeName 解决了它,因为我注意到当 pod 被调度到主节点时它运行没有错误,所以我在部署

You get this error because the image is never pulled to the node, and you are using a never imagePullPolicy , which means that K8S will not pull the image if it doesn't exist or if there is a new version on the docker registry.您收到此错误是因为映像从未拉到节点,并且您使用的是从不imagePullPolicy ,这意味着如果映像不存在或 docker 注册表上有新版本,K8S 将不会拉取该映像。

To solve this problem, you can use imagePullPolicy IfNotPresent to pull the image if it doesn't exist or Always to pull the image at every pod creation.要解决这个问题,您可以使用 imagePullPolicy IfNotPresent来拉取镜像(如果它不存在)或Always在每次创建 Pod 时拉取镜像。

FIRST I SOLVED it like this i am using a local image with containerd i dont need to pull it, i solved it by specifing the node name nodeName because i noticed that when the pod is scheduled to the master node it run without error, so i specified that nodeName in the deployment首先我像这样解决它我正在使用带有容器的本地图像我不需要拉它,我通过指定节点名称 nodeName 解决了它,因为我注意到当 pod 被调度到主节点时它运行没有错误,所以我在部署中指定了 nodeName

FINALLY I SOLVED IT LIKE THIS i just imported my image to all workers nodes and delete that nodeName paramater from the pod and it woeked like a charm最后我解决了这个问题

Since your image is local and/or you can be using a local registry the pull policy Never is fine.由于您的图像是本地的和/或您可以使用本地注册表,因此拉取策略永远不会很好。 Also double check if there is any valid reason to not get the image runnning on any other node.还要仔细检查是否有任何正当理由不让图像在任何其他节点上运行。

Try to not use a nodeName unless it has for example dedicated hardware among other things.尽量不要使用 nodeName ,除非它具有例如专用硬件等。 Theres a big chance to have a taint on your Master.很有可能对你的主人造成污染。

Check the taints on master node if you want to schedule tasks there.如果要在那里安排任务,请检查主节点上的污点。

I would recommend to take a look here for further info: Taints and Tolerations我建议在这里查看更多信息: Taints and Tolerations

Pod Priority and Preemption Pod 优先级和抢占

Node-pressure Eviction 节点压力驱逐

A while ago i solved something really similar using antiaffinity, this video explains perfectly how to achieve it.不久前,我使用反亲和性解决了一些非常相似的问题,这个视频完美地解释了如何实现它。

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

相关问题 使用多个 Docker 主机时,为什么会出现 Unable to create container with image Unable to pull image 错误 pull image? - Why do I get Unable to create container with image Unable to pull image error pulling image when using multiple Docker hosts? docker 拉取镜像策略/设置 - docker pull image policy/settings CircleCI docker 镜像拉取策略 - CircleCI docker image pull policy pod init 中 argo 图像的图像拉回退 - image pull backoff for argo image in pod init 自动拉泊坞窗图像容器 - Automatically pull docker image container 没有“ docker pull”的散装容器图像拉 - Bulk Container image pull without “docker pull” 如何检查 gitlab 容器注册表中是否存在 image:tag - How do I check if an image:tag exists in gitlab container registry 当我试图提取公共图像时,为什么我从Docker获得授权错误? - Why do I get an authorization error from Docker when I'm trying to pull a public image? 当镜像存在于docker Registry-mirror中时,我可以在没有Internet的情况下拉取镜像吗? - Can I pull an image without Internet when the image exists in docker registry-mirror? 在kubernetes helm中拉出azure容器注册表图像 - Pull azure container registry image in kubernetes helm
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM