Skip to content

Commit 726d06f

Browse files
authored
Merge pull request #49936 from saschagrunert/dev-1.33-image-volume-beta
[KEP-4639] Graduate image volume source to beta
2 parents df81e6b + eab6813 commit 726d06f

File tree

4 files changed

+59
-2
lines changed

4 files changed

+59
-2
lines changed

content/en/docs/concepts/storage/volumes.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,8 +615,10 @@ volume with file execution blocked (`noexec`).
615615

616616
Besides that:
617617

618-
- Sub path mounts for containers are not supported
619-
(`spec.containers[*].volumeMounts.subpath`).
618+
- [`subPath`](/docs/concepts/storage/volumes/#using-subpath) or
619+
[`subPathExpr`](/docs/concepts/storage/volumes/#using-subpath-expanded-environment)
620+
mounts for containers (`spec.containers[*].volumeMounts.[subPath,subPathExpr]`)
621+
are only supported from Kubernetes v1.33.
620622
- The field `spec.securityContext.fsGroupChangePolicy` has no effect on this
621623
volume type.
622624
- The [`AlwaysPullImages` Admission Controller](/docs/reference/access-authn-authz/admission-controllers/#alwayspullimages)

content/en/docs/reference/command-line-tools-reference/feature-gates/ImageVolume.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ stages:
99
- stage: alpha
1010
defaultValue: false
1111
fromVersion: "1.31"
12+
toVersion: "1.32"
13+
- stage: beta
14+
defaultValue: false
15+
fromVersion: "1.33"
1216
---
1317
Allow using the [`image`](/docs/concepts/storage/volumes/) volume source in a Pod.
1418
This volume source lets you mount a container image as a read-only volume.

content/en/docs/tasks/configure-pod-container/image-volumes.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,39 @@ to a valid reference and consuming it in the `volumeMounts` of the container. Fo
6767
2
6868
```
6969

70+
## Use `subPath` (or `subPathExpr`)
71+
72+
It is possible to utilize
73+
[`subPath`](/docs/concepts/storage/volumes/#using-subpath) or
74+
[`subPathExpr`](/docs/concepts/storage/volumes/#using-subpath-expanded-environment)
75+
from Kubernetes v1.33 when using the image volume feature.
76+
77+
{{% code_sample file="pods/image-volumes-subpath.yaml" %}}
78+
79+
1. Create the pod on your cluster:
80+
81+
```shell
82+
kubectl apply -f https://k8s.io/examples/pods/image-volumes-subpath.yaml
83+
```
84+
85+
1. Attach to the container:
86+
87+
```shell
88+
kubectl attach -it image-volume bash
89+
```
90+
91+
1. Check the content of the file from the `dir` sub path in the volume:
92+
93+
```shell
94+
cat /volume/file
95+
```
96+
97+
The output is similar to:
98+
99+
```none
100+
1
101+
```
102+
70103
## Further reading
71104

72105
- [`image` volumes](/docs/concepts/storage/volumes/#image)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: image-volume
5+
spec:
6+
containers:
7+
- name: shell
8+
command: ["sleep", "infinity"]
9+
image: debian
10+
volumeMounts:
11+
- name: volume
12+
mountPath: /volume
13+
subPath: dir
14+
volumes:
15+
- name: volume
16+
image:
17+
reference: quay.io/crio/artifact:v1
18+
pullPolicy: IfNotPresent

0 commit comments

Comments
 (0)