@@ -1213,7 +1213,65 @@ in `containers[*].volumeMounts`. Its values are:
1213
1213
(unmounted) by the containers on termination.
1214
1214
{{< /warning >}}
1215
1215
1216
+ # # Read-only mounts
1216
1217
1218
+ A mount can be made read-only by setting the `.spec.containers[].volumeMounts[].readOnly`
1219
+ field to `true`.
1220
+ This does not make the volume itself read-only, but that specific container will
1221
+ not be able to write to it.
1222
+ Other containers in the Pod may mount the same volume as read-write.
1223
+
1224
+ On Linux, read-only mounts are not recursively read-only by default.
1225
+ For example, consider a Pod which mounts the hosts `/mnt` as a `hostPath` volume. If
1226
+ there is another filesystem mounted read-write on `/mnt/<SUBMOUNT>` (such as tmpfs,
1227
+ NFS, or USB storage), the volume mounted into the container(s) will also have a writeable
1228
+ ` /mnt/<SUBMOUNT>` , even if the mount itself was specified as read-only.
1229
+
1230
+ # ## Recursive read-only mounts
1231
+
1232
+ {{< feature-state feature_gate_name="RecursiveReadOnlyMounts" >}}
1233
+
1234
+ Recursive read-only mounts can be enabled by setting the
1235
+ ` RecursiveReadOnlyMounts` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/)
1236
+ for kubelet and kube-apiserver, and setting the `.spec.containers[].volumeMounts[].recursiveReadOnly`
1237
+ field for a pod.
1238
+
1239
+ The allowed values are :
1240
+
1241
+ * `Disabled` (default): no effect.
1242
+
1243
+ * `Enabled`: makes the mount recursively read-only.
1244
+ Needs all the following requirements to be satisfied :
1245
+ * `readOnly` is set to `true`
1246
+ * `mountPropagation` is unset, or, set to `None`
1247
+ * The host is running with Linux kernel v5.12 or later
1248
+ * The [CRI-level](/docs/concepts/architecture/cri) container runtime supports recursive read-only mounts
1249
+ * The OCI-level container runtime supports recursive read-only mounts.
1250
+ It will fail if any of these is not true.
1251
+
1252
+ * `IfPossible`: attempts to apply `Enabled`, and falls back to `Disabled`
1253
+ if the feature is not supported by the kernel or the runtime class.
1254
+
1255
+ Example :
1256
+ {{% code_sample file="storage/rro.yaml" %}}
1257
+
1258
+ When this property is recognized by kubelet and kube-apiserver,
1259
+ the `.status.containerStatuses[].volumeMounts[].recursiveReadOnly` field is set to either
1260
+ ` Enabled` or `Disabled`.
1261
+
1262
+
1263
+ # ### Implementations {#implementations-rro}
1264
+
1265
+ {{% thirdparty-content %}}
1266
+
1267
+ The following container runtimes are known to support recursive read-only mounts.
1268
+
1269
+ CRI-level :
1270
+ - [containerd](https://containerd.io/), since v2.0
1271
+
1272
+ OCI-level :
1273
+ - [runc](https://runc.io/), since v1.1
1274
+ - [crun](https://github.com/containers/crun), since v1.8.6
1217
1275
1218
1276
# # {{% heading "whatsnext" %}}
1219
1277
0 commit comments