Skip to content

Commit eaa5b41

Browse files
committed
changes to address comments and implementation details
Signed-off-by: Mike Brown <[email protected]>
1 parent 037b9e2 commit eaa5b41

File tree

1 file changed

+50
-36
lines changed

1 file changed

+50
-36
lines changed

keps/sig-node/20200310-ensure-secret-pulled-images.md

Lines changed: 50 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,25 @@ superseded-by:
6060

6161
## Summary
6262

63-
We will add support in kubelet for ensuring images pulled with pod
64-
imagePullSecrets are always authenticated even if cached. This new feature will
65-
be enabled via a new kublet flag `ensureSecretPulledImages.` The flag will
66-
improve the security posture for privacy/security of image contents by forcing
67-
images pulled with an imagePullSecret of a first pod to be re-authenticated for
68-
a second pod even if the image is already present on the node. The default
69-
(false) setting means that if a first pod results in an image pulled with
70-
imagePullSecrets a second pod would have to be using always pull to ensure
71-
rights to use the previously pulled image. When set to true always pull would
72-
not be required, instead kubelet will check if the image was pulled with an
73-
image pull secret and if so would force a pull of the image to ensure the image
74-
pulled with the secret is not used by another pod unless that pod also has the
75-
proper auth.
63+
We will add support in kubelet for the pullIfNotPresent image pull policy, for
64+
ensuring images pulled with pod imagePullSecrets are re-authenticated for other
65+
pods that do not have the same imagePullSecret/auths used to successfully pull
66+
the images in the first place.
67+
68+
This policy will have no affect on the `pull never` and `pull always` image pull
69+
policies or for images that are preloaded.
70+
71+
This new feature will be enabled by default. This feature improves the security
72+
posture for privacy/security of image contents by forcing images pulled with an
73+
imagePullSecret/auth of a first pod to be re-authenticated for a second pod even
74+
if the image is already present through the secure pull of the first pod.
75+
76+
The new behavior means that if a first pod results in an image pulled with
77+
imagePullSecrets a second pod would have to also have rights to the image in
78+
order to use a present image.
79+
80+
This means that the image pull policy alwaysPull would no longer be required in
81+
every scenario to ensure image access rights by pods.
7682

7783
## Motivation
7884

@@ -95,16 +101,19 @@ authentication.)
95101

96102
### Goals
97103

98-
Add a `kubelet` flag for `ensureSecretPulledImages` (or something
99-
similarly named) as a security posture enhancement of the kubelet configuration
100-
that, if true, would force `kubelet` to attempt to pull every
101-
image that was pulled with image pulled secret based authentication, regardless
102-
of the container image pull policy.
104+
Modify the current pullIfNotPresent policy management enforced by `kubelet` to
105+
ensure the images pulled with a secret by `kublet` since boot. During the
106+
EnsureImagesExist step `kubelet` will require authentication of present images
107+
pulled with auth since boot.
108+
109+
Optimize to only force re-authentication for a pod container image when the
110+
secret used to pull the container image is not present. IOW if an image is
111+
pulled with authentication for a first pod, subsequent pods that have the same
112+
authentication information should not need to re-authenticate.
103113

104-
Optimize to only force re-authentication for a pod when the secret used to pull
105-
the container image is not present. IOW if an image is pulled with
106-
authentication for a first pod subsequent pods that have the same authentication
107-
information should not need to re-authenticate.
114+
Images already present at boot or loaded externally to `kubelet` or successfully
115+
pulled through `kubelet` with no imagePullSecret/authentication required will
116+
not require authentication.
108117

109118
### Non-Goals
110119

@@ -115,29 +124,33 @@ use un-encrypted...
115124

116125
## Proposal
117126

118-
When `ensureSecretPulledImages` is set, `kubelet` will keep a list of container
119-
images that required authentication. `kubelet` will ensure any image
120-
in the list is always pulled thus enforcing authentication / re-authentication
121-
with the exception of pods with secrets containing an auth that has been
122-
authenticated.
127+
`kubelet` will keep a list, since boot, of container images that required
128+
authentication and a list of the authentications that successfully pulled the image.
129+
130+
`kubelet` will ensure any image in the list is always pulled if an authentication
131+
used is not present, thus enforcing authentication / re-authentication.
132+
123133

124134
### User Stories
125135
wip
126136

127137
### Risks and Mitigations
128138

129-
With the default being false, devops engineers may not know to set the flag to
130-
true.
131-
132-
A mitigation would be a warning message or we could choose to make the default
133-
true.
134-
135139
Image authentications with a registry may expire. To mitigate expirations a
136140
a timeout could be used to force re-authentication. The timeout could be a
137-
container runtime feature or a `kubelet` feature.
141+
container runtime feature or a `kubelet` feature. If at the container runtime,
142+
images would not be present during the EnsureImagesExist step, thus would have
143+
to be pulled and authenticated if necessary.
144+
145+
Since images can be pre-loaded, loaded outside the `kubelet` process, and
146+
garbage collected.. the list of images that required authentication in `kubelet`
147+
will not be a source of truth for how all images were pulled that are in the
148+
container runtime cache. To mitigate images can be garbage collected at boot.
138149

139150
## Design Details
140151

152+
See PR.
153+
141154
### Test Plan
142155

143156
tbd
@@ -148,7 +161,7 @@ tbd
148161

149162
#### Examples
150163

151-
These are generalized examples to consider, in addition to the aforementioned [maturity levels][maturity-levels].
164+
tbd
152165

153166
##### Alpha -> Beta Graduation
154167

@@ -168,7 +181,8 @@ Why should this KEP _not_ be implemented. N/A
168181

169182
## Alternatives [optional]
170183

171-
- Make the option a `kubelet` configuration switch (This is the SIG-Node suggested option).
184+
- Make the behavior change a `kubelet` configuration switch (This was the SIG-Node suggested option).
185+
However after discussions it seems this should be the default security posture for pullIfNotPresent as it is not clear to admins/users that an image pulled by a first pod with authentication can be used by a second pod without authentication. The performance cost should be minimal as only the manifest needs to be re-authenticated.
172186
- Set the flag at some other scope e.g. pod spec (doing it at the pod spec was rejected by SIG-Node).
173187

174188
## Infrastructure Needed [optional]

0 commit comments

Comments
 (0)