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
Copy file name to clipboardExpand all lines: keps/sig-node/20200310-ensure-secret-pulled-images.md
+50-36Lines changed: 50 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,19 +60,25 @@ superseded-by:
60
60
61
61
## Summary
62
62
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.
76
82
77
83
## Motivation
78
84
@@ -95,16 +101,19 @@ authentication.)
95
101
96
102
### Goals
97
103
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.
103
113
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.
108
117
109
118
### Non-Goals
110
119
@@ -115,29 +124,33 @@ use un-encrypted...
115
124
116
125
## Proposal
117
126
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
+
123
133
124
134
### User Stories
125
135
wip
126
136
127
137
### Risks and Mitigations
128
138
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
-
135
139
Image authentications with a registry may expire. To mitigate expirations a
136
140
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.
138
149
139
150
## Design Details
140
151
152
+
See PR.
153
+
141
154
### Test Plan
142
155
143
156
tbd
@@ -148,7 +161,7 @@ tbd
148
161
149
162
#### Examples
150
163
151
-
These are generalized examples to consider, in addition to the aforementioned [maturity levels][maturity-levels].
164
+
tbd
152
165
153
166
##### Alpha -> Beta Graduation
154
167
@@ -168,7 +181,8 @@ Why should this KEP _not_ be implemented. N/A
168
181
169
182
## Alternatives [optional]
170
183
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.
172
186
- Set the flag at some other scope e.g. pod spec (doing it at the pod spec was rejected by SIG-Node).
0 commit comments