kubernetes: Kubelet restart cause running pod restart with UnexpectedAdmissionError when pods have initContainers and external devices like GPU
What happened?
When restarting kubelet, it will restart the running pods with UnexpectedAdmissionError when pods’ initContainers and containers both use external devices like GPU
What did you expect to happen?
Restart kubelet should not cause running pods to restart
How can we reproduce it (as minimally and precisely as possible)?
- create some pods with nvidia.com/gpu and initContainers which also use GPUs
- wait until initContainers exit
- restart kubelet
Anything else we need to know?
there was an issue and a fix for running pods with devices, but it looks like the initContainers is not counted as should skip containers.
the fix has cherry-picked to v1.25.16
- issue: https://github.com/kubernetes/kubernetes/issues/118559
- fix: https://github.com/kubernetes/kubernetes/pull/118635
- cherry-pick v1.25 since v1.25.14: https://github.com/kubernetes/kubernetes/pull/119707
Related Issues:
- Completed Pod will also be affected: https://github.com/kubernetes/kubernetes/issues/117955
- memory manager related kubelet restart cause UnexpectedAdmissionError: https://github.com/kubernetes/kubernetes/issues/123971
Kubernetes version
$ kubectl version
# 1.25.16
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
- Reactions: 1
- Comments: 26 (19 by maintainers)
This is the change I was hinting at (and which I didn’t have handy, yet). There could be further work to be done in this area though, which we need to check. This is what I meant in https://github.com/kubernetes/kubernetes/issues/124345#issuecomment-2685931651
Of cause, but maybe need some another time, once done, i will update it here. But we have checked the kubelet logic and added some logs to make sure the position, and double checked the master branch is still not changed, so that it should be easy to reproduce.
The is a bug related in nv device plugins that may crash when kubelet restarts, but i have not yet deep dived into it. But even without that bug, a kubelet restart will ask all the device plugins to restart and register their socks by design, so that there will be a chance there will be no healthy devices when kubelet starts. The main problem is that kubelet should not allocate devices for the completed containers like completed jobs and init containers