Skip to content

Commit d1f7db1

Browse files
committed
KEP-2535: update the handling of Never PullImagePolicy
Signed-off-by: Peter Hunt <[email protected]>
1 parent 53ad473 commit d1f7db1

File tree

1 file changed

+16
-11
lines changed
  • keps/sig-node/2535-ensure-secret-pulled-images

1 file changed

+16
-11
lines changed

keps/sig-node/2535-ensure-secret-pulled-images/README.md

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,21 @@ when the `ImagePullPolicy` is `IfNotPresent`.
6969

7070
In other words: ensure the pull secrets are rechecked for each new set of credentials, and ensure a pod has access to those images.
7171

72-
This policy change will have no affect on the `Always` `ImagePullPolicy` or for images that are preloaded.
72+
For the `Never` policy, the behavior also must change. Otherwise, a user who wishes to use the image of another pod could just use `Never` and hope
73+
another pod have pulled it. Functionally from a security standpoint, we must account for this.
74+
Thus, `Never` `ImagePullPolicy` images will be allowed past the ensure image stage of the pod lifecyle if the image has previously been pulled
75+
by an `IfNotPresent` pod successfully: either with no auth, or with the same auth as the `Never` policy. The image will continue to never be pulled
76+
for this pod.
7377

74-
However, for the `Never` policy if a first pod successfully pulled an image
75-
with credential and then a second pod with pull never tried to use the image,
76-
when the feature gate is on the second pod will receive an error message, where
77-
before and with the feature gate off the second pod would be able to use the image
78-
pulled with credentials by the first pod.
78+
This will be enforced for both policies regardless of whether the image is already present when the kubelet starts. For an image to be allowed to be used,
79+
the kubelet must be aware of its credentials.
7980

80-
This new feature will be enabled with a feature gate in alpha, as well as two kubelet configuration
81-
fields `pullImageSecretRecheck` and `pullImageSecretRecheckPeriod`.
81+
This policy change will have no affect on the `Always` `ImagePullPolicy`.
82+
83+
This new feature will be enabled with a feature gate in alpha, as well as a kubelet configuration
84+
field `pullImageSecretRecheck`. Another kubelet configuration field `pullImageSecretRecheckPeriod` will be added
85+
to allow an admin to configure the recheck period. A recheck period may be used to periodically clean the cache, or ensure
86+
expiring credentials are still valid.
8287

8388
*** The issue and these changes improving the security posture without requiring the forcing of pull always, will be documented in the kubernetes image pull policy documentation. The new feature gate should also be documented in release notes. ***
8489

@@ -105,7 +110,7 @@ regardless of whether the image is already present on the node.
105110

106111
### Goals
107112

108-
Modify the current behavior of images with an `IfNotPresent` `ImagePullPolicy` enforced by the kubelet to
113+
Modify the current behavior of images with an `IfNotPresent` and `Never` `ImagePullPolicy` enforced by the kubelet to
109114
ensure the images pulled with a secret by the kubelet are authenticated by the CRI implementation. During the
110115
EnsureImagesExist step the kubelet will require authentication of present images pulled with auth since boot.
111116

@@ -125,8 +130,7 @@ runtimes through the CRI wrt. how they should treat the caching of images on a
125130
node. Such as store for public use but only if encrypted. Or Store for private
126131
use un-encrypted...
127132

128-
This feature will not change the behavior of pod with `ImagePullPolicy` `Always`
129-
and `Never`.
133+
This feature will not change the behavior of pod with `ImagePullPolicy` `Always`.
130134

131135
## Proposal
132136

@@ -477,6 +481,7 @@ Why should this KEP _not_ be implemented. TBD
477481
- For beta/ga we may revisit/replace the in memory hash map in kubelet design, with an extension to the CRI API for having the container runtime
478482
ensure the image instead of kubelet.
479483
- Discussions went back and forth as to whether to persist the cache across reboots. It was decided to do so.
484+
- `Never` could be always allowed to use an image on the node, regardless of its presence on the node. However, this would functionally disable this feature from a security standpoint.
480485

481486
## Infrastructure Needed [optional]
482487

0 commit comments

Comments
 (0)