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 @@ -615,8 +615,10 @@ volume with file execution blocked (`noexec`).
615
615
616
616
Besides that :
617
617
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.
620
622
- The field `spec.securityContext.fsGroupChangePolicy` has no effect on this
621
623
volume type.
622
624
- The [`AlwaysPullImages` Admission Controller](/docs/reference/access-authn-authz/admission-controllers/#alwayspullimages)
Original file line number Diff line number Diff line change 9
9
- stage : alpha
10
10
defaultValue : false
11
11
fromVersion : " 1.31"
12
+ toVersion : " 1.32"
13
+ - stage : beta
14
+ defaultValue : false
15
+ fromVersion : " 1.33"
12
16
---
13
17
Allow using the [ ` image ` ] ( /docs/concepts/storage/volumes/ ) volume source in a Pod.
14
18
This 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
67
67
2
68
68
```
69
69
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
+
70
103
## Further reading
71
104
72
105
- [ ` 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