Skip to content

Commit 15b0361

Browse files
committed
Feature blog 1.33: Image volumes graduate to beta
Signed-off-by: Sascha Grunert <[email protected]>
1 parent 686bfbe commit 15b0361

File tree

1 file changed

+70
-0
lines changed
  • content/en/blog/_posts/2025-MM-DD-image-volume-beta

1 file changed

+70
-0
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
layout: blog
3+
title: "Kubernetes 1.33: Image Volumes graduate to beta!"
4+
date: 2025-MM-DD
5+
slug: image-voume-beta
6+
author: Sascha Grunert (Red Hat)
7+
---
8+
9+
[Image Volumes](/blog/2024/08/16/kubernetes-1-31-image-volume-source) were
10+
introduced as an Alpha feature with the Kubernetes v1.31 release as part of
11+
[KEP-4639](https://github.com/kubernetes/enhancements/issues/4639). The recent
12+
release of Kubernetes v1.33 moved that support to **beta**.
13+
14+
Please note that the feature is still _disabled_ by default, because not all
15+
[container runtimes](/docs/setup/production-environment/container-runtimes) have
16+
full support for it. [CRI-O](https://cri-o.io) supports the initial feature since version v1.31 and
17+
will add support for Image Volumes as beta in v1.33.
18+
[containerd](https://containerd.io) merged support for the alpha feature, but
19+
has not released it yet.
20+
21+
### What's new
22+
23+
The major change for the beta graduation of Image Volumes is the support for
24+
[`subPath`](/docs/concepts/storage/volumes/#using-subpath) and
25+
[`subPathExpr`](/docs/concepts/storage/volumes/#using-subpath-expanded-environment) mounts
26+
for containers via `spec.containers[*].volumeMounts.[subPath,subPathExpr]`. This
27+
allows end-users to mount a certain subdirectory of an image volume, which is
28+
still mounted as readonly (`noexec`). This means that non-existing
29+
subdirectories cannot be mounted by default. As for other `subPath` and
30+
`subPathExpr` values, Kubernetes will ensure that there are no absolute path or
31+
relative path components part of the specified sub path. Container runtimes are
32+
also required to double check those requirements for safety reasons. If a
33+
specified subdirectory does not exist within a volume, then runtimes should fail
34+
on container creation and provide user feedback by using existing kubelet
35+
events.
36+
37+
There are also three new kubelet metrics available for image volumes:
38+
39+
- `kubelet_image_volume_requested_total`: Outlines the number of requested image volumes.
40+
- `kubelet_image_volume_mounted_succeed_total`: Counts the number of successful image volume mounts.
41+
- `kubelet_image_volume_mounted_errors_total`: Accounts the number of failed image volume mounts.
42+
43+
To use an existing subdirectory for a specific image volume, just use it as
44+
`subPath` value of the containers `volumeMounts`:
45+
46+
{{% code_sample file="pods/image-volumes-subpath.yaml" %}}
47+
48+
1. Create the pod on your cluster:
49+
50+
```shell
51+
kubectl apply -f https://k8s.io/examples/pods/image-volumes-subpath.yaml
52+
```
53+
54+
1. Attach to the container:
55+
56+
```shell
57+
kubectl attach -it image-volume bash
58+
```
59+
60+
1. Check the content of the file from the `dir` sub path in the volume:
61+
62+
```shell
63+
cat /volume/file
64+
```
65+
66+
The output is similar to:
67+
68+
```none
69+
1
70+
```

0 commit comments

Comments
 (0)