You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We will add support in kubelet for the `pullIfNotPresent` image pull policy, for
@@ -133,6 +133,9 @@ runtimes through the CRI wrt. how they should treat the caching of images on a
133
133
node. Such as store for public use but only if encrypted. Or Store for private
134
134
use un-encrypted...
135
135
136
+
This feature will not change the behavior of pod with image pull policy `Always`
137
+
and `Never`.
138
+
136
139
## Proposal
137
140
138
141
For alpha `kubelet` will keep a list, across reboots of host and restart of
@@ -143,18 +146,18 @@ For beta an API will be considered to manage the ensure metadata.
143
146
`kubelet` will ensure any image in the list is always pulled if an authentication
144
147
used is not present, thus enforcing authentication / re-authentication.
145
148
146
-
147
149
### User Stories
148
150
149
151
#### Story 1
152
+
150
153
User with multiple tenants will be able to support all image pull policies without
151
154
concern that one tenant will gain access to an image that they don't have rights to.
152
155
153
156
#### Story 2
157
+
154
158
User will will no longer have to inject the Pull Always Image Pull Policy to
155
159
ensure all tenants have rights to the images that are already present on a host.
156
160
157
-
158
161
### Notes/Constraints/Caveats (Optional)
159
162
160
163
With the default of the feature gate being off, users / cloud providers will have
@@ -173,42 +176,36 @@ Since images can be pre-loaded, loaded outside the `kubelet` process, and
173
176
garbage collected.. the list of images that required authentication in `kubelet`
174
177
will not be a source of truth for how all images were pulled that are in the
175
178
container runtime cache. To mitigate, images can be garbage collected at boot.
176
-
And we will persist ensure metadata across reboot of host, and restart
179
+
And for alpha, we will not persist ensure metadata across reboot of host, and restart
177
180
of kubelet, and possibly look at a way to add ensure metadata for images loaded
178
181
outside of kubelet. In beta we will add a switch to enable re-auth on boot for
179
182
admins seeking that instead of having to garbage collect where they do not use
180
183
or expect preloaded images since boot.
181
184
182
-
183
185
## Design Details
184
186
185
-
Kubelet will track, in memory, a hash map for the credentials that were successfully used to pull an image. It has been decided that the hash map will be persisted to disk, in alpha.
187
+
Kubelet will track, in memory, a hash map for the credentials that were successfully
188
+
used to pull an image.
186
189
187
-
The persisted "cache" will undergo cleanup operations on a timely basis (by default once an hour).
190
+
See PR linked above for detailed design / behavior documentation.
188
191
189
-
The persistence of the on storage cache is mainly for restarting kubelet and/or node reboot.
192
+
Kubelet will add a new flag, named `PullImageSecretRecheckDuration` to make
193
+
the expired duration configurable. The default value could be 1d. For a pod with
194
+
IfNotPresent image pull policy and an image pull secret, kubelet will recheck
195
+
the secret after `PullImageSecretRecheckDuration`.
190
196
191
-
The max size of the cache will scale with the number of unique cache entries * the number of unique images that have not been garbage collected. It is not expected that this will be a significant number of bytes. Will be verified by actual use in Alpha and subsequent metrics in Beta.
197
+
Use image pull policy `Always` if user want to recheck the secret everytime.
192
198
193
-
See `/var/lib/kubelet/image_manager_state` in [kubernetes/kubernetes#114847](https://github.com/kubernetes/kubernetes/pull/114847)
199
+
For image pull policy "if not present", when admin/user doesn't want to automatically
200
+
recheck the secret, set `PullImageSecretRecheckDuration` to 0 to disable it(which means
Note: using the tag `:latest` is equivalent to using the image pull policy `Always.`
210
204
211
-
See PR linked above for detailed design / behavior documentation.
205
+
Note: since the cache is not persisted to disk, a recheck will happen every kubelet restart.
206
+
This is acceptable because kubelet only restarts during upgrades or in maintenance modes.
207
+
In other words, it should be relatively infrequent(and much less frequent than the default
208
+
value of `PullImageSecretRecheckDuration`).
212
209
213
210
### Test Plan
214
211
@@ -218,41 +215,43 @@ necessary to implement this enhancement.
218
215
219
216
##### Prerequisite testing updates
220
217
221
-
222
218
##### Unit tests
223
219
224
220
For alpha, exhaustive Kubelet unit tests will be provided. Functions affected by the feature gate will be run with the feature gate on and with the feature gate off. Unit buckets will be provided for:
221
+
225
222
- HashAuth - (new, small) returns a hash code for a CRI pull image auth [link](https://github.com/kubernetes/kubernetes/pull/94899/files#diff-ca08601dfd2fdf846f066d0338dc332beddd5602ab3a71b8fac95b419842da63R704-R751)** per review comment will use SHA256 **
226
223
- shouldPullImage - (modified, large sized change) determines if image should be pulled based on presence, and image pull policy, and now with the feature gate on if the image has been pulled/ensured by a secret. A unit test bucket did not exist for this function. The unit bucket will cover a matrix for:
Additionally, for Alpha we will update this readme with an enumeration of the core packages being touched by the PR to implement this enhancement and provide the current unit coverage for those in the form of:
0 commit comments