[KEP-4639] Graduate image volume source to beta

Update the documentation to reflect the graduated feature.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
pull/49936/head
Sascha Grunert 2025-02-27 09:19:18 +01:00
parent edf6a645fa
commit eab681370c
No known key found for this signature in database
GPG Key ID: 09D97D153EF94D93
4 changed files with 59 additions and 2 deletions

View File

@ -628,8 +628,10 @@ volume with file execution blocked (`noexec`).
Besides that:
- Sub path mounts for containers are not supported
(`spec.containers[*].volumeMounts.subpath`).
- [`subPath`](/docs/concepts/storage/volumes/#using-subpath) or
[`subPathExpr`](/docs/concepts/storage/volumes/#using-subpath-expanded-environment)
mounts for containers (`spec.containers[*].volumeMounts.[subPath,subPathExpr]`)
are only supported from Kubernetes v1.33.
- The field `spec.securityContext.fsGroupChangePolicy` has no effect on this
volume type.
- The [`AlwaysPullImages` Admission Controller](/docs/reference/access-authn-authz/admission-controllers/#alwayspullimages)

View File

@ -9,6 +9,10 @@ stages:
- stage: alpha
defaultValue: false
fromVersion: "1.31"
toVersion: "1.32"
- stage: beta
defaultValue: false
fromVersion: "1.33"
---
Allow using the [`image`](/docs/concepts/storage/volumes/) volume source in a Pod.
This volume source lets you mount a container image as a read-only volume.

View File

@ -67,6 +67,39 @@ to a valid reference and consuming it in the `volumeMounts` of the container. Fo
2
```
## Use `subPath` (or `subPathExpr`)
It is possible to utilize
[`subPath`](/docs/concepts/storage/volumes/#using-subpath) or
[`subPathExpr`](/docs/concepts/storage/volumes/#using-subpath-expanded-environment)
from Kubernetes v1.33 when using the image volume feature.
{{% code_sample file="pods/image-volumes-subpath.yaml" %}}
1. Create the pod on your cluster:
```shell
kubectl apply -f https://k8s.io/examples/pods/image-volumes-subpath.yaml
```
1. Attach to the container:
```shell
kubectl attach -it image-volume bash
```
1. Check the content of the file from the `dir` sub path in the volume:
```shell
cat /volume/file
```
The output is similar to:
```none
1
```
## Further reading
- [`image` volumes](/docs/concepts/storage/volumes/#image)

View File

@ -0,0 +1,18 @@
apiVersion: v1
kind: Pod
metadata:
name: image-volume
spec:
containers:
- name: shell
command: ["sleep", "infinity"]
image: debian
volumeMounts:
- name: volume
mountPath: /volume
subPath: dir
volumes:
- name: volume
image:
reference: quay.io/crio/artifact:v1
pullPolicy: IfNotPresent