Skip to content

Commit 8fc5479

Browse files
authored
Merge pull request #49886 from dshebib/2535-secret-pulled-images-alpha
KEP 2535: Ensure Secret Pulled Images
2 parents 9cd79f4 + 5a1b532 commit 8fc5479

File tree

3 files changed

+73
-1
lines changed

3 files changed

+73
-1
lines changed

content/en/docs/concepts/containers/images.md

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,10 @@ you must ensure all nodes in the cluster have the same pre-pulled images.
367367
This can be used to preload certain images for speed or as an alternative to authenticating to a
368368
private registry.
369369

370-
All pods will have read access to any pre-pulled images.
370+
{{< note >}}
371+
{{< feature-state feature_gate_name="KubeletEnsureSecretPulledImages" >}}
372+
Access to pre-pulled images may be authorized according to [image pull credential verification](#ensureimagepullcredentialverification)
373+
{{< /note >}}
371374

372375
### Specifying imagePullSecrets on a Pod
373376

@@ -380,6 +383,43 @@ Kubernetes supports specifying container image registry keys on a Pod.
380383
`imagePullSecrets` must all be in the same namespace as the Pod. The referenced
381384
Secrets must be of type `kubernetes.io/dockercfg` or `kubernetes.io/dockerconfigjson`.
382385

386+
#### Ensure Image Pull Credential Verification {#ensureimagepullcredentialverification}
387+
388+
{{< feature-state feature_gate_name="KubeletEnsureSecretPulledImages" >}}
389+
390+
If the `KubeletEnsureSecretPulledImages` feature gate is enabled, Kubernetes will validate
391+
image credentials for every image that requires credentials to be pulled,
392+
even if that image is already present on the node.
393+
This validation ensures that images in a pod request which have not been successfully pulled
394+
with the provided credentials must re-pull the images from the registry.
395+
Additionally, image pulls that re-use the same credentials
396+
which previously resulted in a successful image pull will not need to re-pull from the registry
397+
and are instead validated locally without accessing the registry
398+
(provided the image is available locally).
399+
This is controlled by the`imagePullCredentialsVerificationPolicy` field in the
400+
[Kubelet configuration](/docs/reference/config-api/kubelet-config.v1beta1#ImagePullCredentialsVerificationPolicy).
401+
402+
This configuration controls when image pull credentials must be verified if the
403+
image is already present on the node:
404+
405+
* `NeverVerify`: Mimics the behavior of having this feature gate disabled.
406+
If the image is present locally, image pull credentials are not verified.
407+
* `NeverVerifyPreloadedImages`: Images pulled outside the kubelet are not verified,
408+
but all other images will have their credentials verified. This is the default behavior.
409+
* `NeverVerifyAllowListedImages`: Images pulled outside the kubelet and mentioned within the
410+
`preloadedImagesVerificationAllowlist` specified in the kubelet config are not verified.
411+
* `AlwaysVerify`: All images will have their credentials verified
412+
before they can be used.
413+
414+
This verification applies to [pre-pulled images](#pre-pulled-images),
415+
images pulled using node-wide secrets, and images pulled using pod-level secrets.
416+
417+
{{< note >}}
418+
In the case of credential rotation, the credentials previously used to pull the image
419+
will continue to verify without the need to access the registry. New or rotated credentials
420+
will require the image to be re-pulled from the registry.
421+
{{< /note >}}
422+
383423
#### Creating a Secret with a Docker config
384424

385425
You need to know the username, registry password and client email address for authenticating
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: KubeletEnsureSecretPulledImages
3+
content_type: feature_gate
4+
_build:
5+
list: never
6+
render: false
7+
8+
stages:
9+
- stage: alpha
10+
defaultValue: false
11+
fromVersion: "1.33"
12+
---
13+
Ensure that pods requesting an image are authorized to access the image
14+
with the provided credentials when the image is already present on the node.
15+
See [Ensure Image Pull Credential Verification](/docs/concepts/containers/images#ensureimagepullcredentialverification).

content/en/docs/reference/node/kubelet-files.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,23 @@ The types of plugins that can place socket files into that directory are:
148148
[Graceful node shutdown](/docs/concepts/cluster-administration/node-shutdown/#graceful-node-shutdown)
149149
stores state locally at `/var/lib/kubelet/graceful_node_shutdown_state`.
150150

151+
### Image Pull Records
152+
153+
{{< feature-state feature_gate_name="KubeletEnsureSecretPulledImages" >}}
154+
155+
The kubelet stores records of attempted and successful image pulls, and uses it
156+
to verify that the image was previously successfully pulled with the same credentials.
157+
158+
These records are cached as files in the `image_registry` directory within
159+
the kubelet base directory. On a typical Linux node, this means `/var/lib/kubelet/image_manager`.
160+
There are two subdirectories to `image_manager`:
161+
* `pulling` - stores records about images the Kubelet is attempting to pull.
162+
* `pulled` - stores records about images that were successfully pulled by the Kubelet,
163+
along with metadata about the credentials used for the pulls.
164+
165+
See [Ensure Image Pull Credential Verification](/docs/concepts/containers/images#ensureimagepullcredentialverification)
166+
for details.
167+
151168
## Security profiles & configuration
152169

153170
### Seccomp

0 commit comments

Comments
 (0)