File tree Expand file tree Collapse file tree 4 files changed +59
-2
lines changed
reference/command-line-tools-reference/feature-gates
tasks/configure-pod-container Expand file tree Collapse file tree 4 files changed +59
-2
lines changed Original file line number Diff line number Diff line change @@ -628,8 +628,10 @@ volume with file execution blocked (`noexec`).
628628
629629Besides that :
630630
631- - Sub path mounts for containers are not supported
632- (`spec.containers[*].volumeMounts.subpath`).
631+ - [`subPath`](/docs/concepts/storage/volumes/#using-subpath) or
632+ [`subPathExpr`](/docs/concepts/storage/volumes/#using-subpath-expanded-environment)
633+ mounts for containers (`spec.containers[*].volumeMounts.[subPath,subPathExpr]`) are only
634+ supported from Kubernetes v1.33.
633635- The field `spec.securityContext.fsGroupChangePolicy` has no effect on this
634636 volume type.
635637- The [`AlwaysPullImages` Admission Controller](/docs/reference/access-authn-authz/admission-controllers/#alwayspullimages)
Original file line number Diff line number Diff line change 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---
1317Allow using the [ ` image ` ] ( /docs/concepts/storage/volumes/ ) volume source in a Pod.
1418This volume source lets you mount a container image as a read-only volume.
Original file line number Diff line number Diff 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 )
Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments