Skip to content

Commit aae73ce

Browse files
committed
Feature blog 1.33: Image volumes graduate to beta
Signed-off-by: Sascha Grunert <[email protected]>
1 parent 3eebfc1 commit aae73ce

File tree

1 file changed

+108
-0
lines changed
  • content/en/blog/_posts/2025-05-01-image-volume-beta

1 file changed

+108
-0
lines changed
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
---
2+
layout: blog
3+
title: "Kubernetes 1.33: Image Volumes graduate to beta!"
4+
date: 2025-05-01
5+
draft: true
6+
slug: image-voume-beta
7+
author: Sascha Grunert (Red Hat)
8+
---
9+
10+
[Image Volumes](/blog/2024/08/16/kubernetes-1-31-image-volume-source) were
11+
introduced as an Alpha feature with the Kubernetes v1.31 release as part of
12+
[KEP-4639](https://github.com/kubernetes/enhancements/issues/4639). The recent
13+
release of Kubernetes v1.33 moved that support to **beta**.
14+
15+
Please note that the feature is still _disabled_ by default, because not all
16+
[container runtimes](/docs/setup/production-environment/container-runtimes) have
17+
full support for it. [CRI-O](https://cri-o.io) supports the initial feature since version v1.31 and
18+
will add support for Image Volumes as beta in v1.33.
19+
[containerd merged](https://github.com/containerd/containerd/pull/10579) support
20+
for the alpha feature which will be part of the v2.1.0 release and is working on
21+
beta support as part of [PR #11578](https://github.com/containerd/containerd/pull/11578).
22+
23+
### What's new
24+
25+
The major change for the beta graduation of Image Volumes is the support for
26+
[`subPath`](/docs/concepts/storage/volumes/#using-subpath) and
27+
[`subPathExpr`](/docs/concepts/storage/volumes/#using-subpath-expanded-environment) mounts
28+
for containers via `spec.containers[*].volumeMounts.[subPath,subPathExpr]`. This
29+
allows end-users to mount a certain subdirectory of an image volume, which is
30+
still mounted as readonly (`noexec`). This means that non-existing
31+
subdirectories cannot be mounted by default. As for other `subPath` and
32+
`subPathExpr` values, Kubernetes will ensure that there are no absolute path or
33+
relative path components part of the specified sub path. Container runtimes are
34+
also required to double check those requirements for safety reasons. If a
35+
specified subdirectory does not exist within a volume, then runtimes should fail
36+
on container creation and provide user feedback by using existing kubelet
37+
events.
38+
39+
Beside that, there are also three new kubelet metrics available for image volumes:
40+
41+
- `kubelet_image_volume_requested_total`: Outlines the number of requested image volumes.
42+
- `kubelet_image_volume_mounted_succeed_total`: Counts the number of successful image volume mounts.
43+
- `kubelet_image_volume_mounted_errors_total`: Accounts the number of failed image volume mounts.
44+
45+
To use an existing subdirectory for a specific image volume, just use it as
46+
[`subPath`](/docs/concepts/storage/volumes/#using-subpath) (or
47+
[`subPathExpr`](/docs/concepts/storage/volumes/#using-subpath-expanded-environment))
48+
value of the containers `volumeMounts`:
49+
50+
```yaml
51+
apiVersion: v1
52+
kind: Pod
53+
metadata:
54+
name: image-volume
55+
spec:
56+
containers:
57+
- name: shell
58+
command: ["sleep", "infinity"]
59+
image: debian
60+
volumeMounts:
61+
- name: volume
62+
mountPath: /volume
63+
subPath: dir
64+
volumes:
65+
- name: volume
66+
image:
67+
reference: quay.io/crio/artifact:v1
68+
pullPolicy: IfNotPresent
69+
```
70+
71+
Then, create the pod on your cluster:
72+
73+
```shell
74+
kubectl apply -f image-volumes-subpath.yaml
75+
```
76+
77+
Now you can attach to the container:
78+
79+
```shell
80+
kubectl attach -it image-volume bash
81+
```
82+
83+
And check the content of the file from the `dir` sub path in the volume:
84+
85+
```shell
86+
cat /volume/file
87+
```
88+
89+
The output will be similar to:
90+
91+
```none
92+
1
93+
```
94+
95+
Thank you for reading through the end of this blog post! SIG Node is proud and
96+
happy to deliver this feature graduation as part of Kubernetes v1.33.
97+
98+
As writer of this blog post, I would like to emphasize my special thanks to
99+
**all** involved individuals out there!
100+
101+
If you would like to provide feedback or suggestions feel free to reach out
102+
to SIG Node using the [Kubernetes Slack (#sig-node)](https://kubernetes.slack.com/messages/sig-node)
103+
channel or the [SIG Node mailing list](https://groups.google.com/g/kubernetes-sig-node).
104+
105+
## Further reading
106+
107+
- [Use an Image Volume With a Pod](/docs/tasks/configure-pod-container/image-volumes)
108+
- [`image` volume overview](/docs/concepts/storage/volumes/#image)

0 commit comments

Comments
 (0)