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
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
CodePudding user response:
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.
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.
CodePudding user response:
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
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