kubernetes: Pods in ImagePullBackOff get stuck there, if image fails to pull for long enough
What happened?
We have a pod that was stuck in ``/ImagePullBackOff: initially, this was caused by the pull secret not existing. Mea culpa.
We corrected that issue; however, by the time it was corrected, much time has passed (several hours) and even though the secret now exists, the image is still stuck; it spends most of its time in ImagePullBackOff, but occaisonally alternates to ErrImagePull.
The event logs only show:
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal BackOff 4m55s (x5959 over 22h) kubelet Back-off pulling image "<the image>"
… but no attempts appear to be being made to actually pull the image, nor are there now any errors about why we’re in backing off. We’re backing off… but not actually doing anything?
The kubelet’s logs seem to confirm this, containing only this error AFAICT:
1:23:18.001 PM | E0810 17:23:18.000705 1766 pod_workers.go:965] "Error syncing pod, skipping" err="failed to \"StartContainer\" for \"graphql-fhir-translator\" with ImagePullBackOff: \"Back-off pulling image \\\"<the image>\\\"\"" pod="<the NS>/<the pod>" podUID=1193f710-eeae-4761-84b6-176acbd97ea6
Again, AFAICT, no attempt to actually pull the image.
It took me cordoning all nodes, then re-creating the pod, to finally get this event:
Warning Failed 13s kubelet Failed to pull image "<the image>": json: cannot unmarshal string into Go struct field DockerConfigJSON.auths of type credentialprovider.dockerConfigEntryWithAuth
Which, okay, that’s better! But this should have been present in the logs from the get-go.
What did you expect to happen?
I expect the kubelet to keep attempting to pull the image, at whatever the maximum backoff delay interval is, since it has been several hours. (Or some randomized value between [0, that interval].) I expect retries. If something remains incorrect, it should get logged.
How can we reproduce it (as minimally and precisely as possible)?
See “What happened?” — I think following those events (have a container in ImagePullBackOff for several hours, then fix the underlying issue) is sufficient.
Anything else we need to know?
No response
Kubernetes version
1.24.13-gke.2500
Cloud provider
OS version
# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here
# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here
Install tools
Container runtime (CRI) and version (if applicable)
Related plugins (CNI, CSI, …) and versions (if applicable)
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (11 by maintainers)
/wg batch
This is a very important problem when using a queueing system. A user that submits a Job wouldn’t know that the image is invalid until the job actually starts running. But it might be hours since the job submission when the job starts running. At that point, the job could block a good chunk of the cluster with no way of automatically freeing those resources.