-
Notifications
You must be signed in to change notification settings - Fork 41.1k
kubelet: don't fetch image credentials if the image is present and if we don't need to check if the pod is allowed to pull it #133079
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
k8s-ci-robot
merged 1 commit into
kubernetes:master
from
Apptane:fetch-image-credentials-later
Jul 21, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change looks fine and likely restores the old behavior. The issue will still exist when the
KubeletEnsureSecretPulledImages
feature gate is enabled by default.@stlaz we should think about how to avoid calling credential provider plugins when the image is preloaded or the pull policy is
Never
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @liggitt
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I made a note to myself to configure it to not verify when it goes GA.
As I see it, this must rely on some kind of declared dependency between pods such that pod A being allowed to access an image means that pod B (somehow linked to A, perhaps with an annotation) is also allowed without additional checks. The upgrade workflow I stumbled upon this already requires a preflight daemonset, which runs while the previous version of the main daemonset is still running, to pull the new version image, because when the main daemonset pod stops, the kubelet won't be able to pull the new image any more than it will be able to acquire credentials. There is no problem with kubelet checking pod image accessibility for preflight daemonset pods.
It is of course possible to add the critical image to
preloadedImagesVerificationAllowlist
, but that allows access to it to every pod.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Narrowly moving this if block up is ~fine for now, but I expect the credential verification feature to go to get and default-enable ~soon, at which point credential providers will be called again.
that seems like a potential deadlock issue with those credential plugins that needs resolving independent of the credential reverification feature
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I.e. to authenticate to CR and pull the image? That's handled by preflight daemonsets, as I mentioned above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but that's not correct behavior, isn't it? E.g. if the image pull credential verification policy is NeverVerify, there is no reason to call them. I added an early check for decisions of this type: #133114