@@ -440,7 +440,17 @@ To assign SELinux labels, the SELinux security module must be loaded on the host
440
440
441
441
# ## Efficient SELinux volume relabeling
442
442
443
- {{< feature-state for_k8s_version="v1.27" state="beta" >}}
443
+ {{< feature-state feature_gate_name="SELinuxMountReadWriteOncePod" >}}
444
+
445
+ {{< note >}}
446
+ Kubernetes v1.27 introduced an early limited form of this behavior that was only applicable
447
+ to volumes (and PersistentVolumeClaims) using the `ReadWriteOncePod` access mode.
448
+
449
+ As an alpha feature, you can enable the `SELinuxMount`
450
+ [feature gate](/docs/reference/command-line-tools-reference/feature-gates/) to widen that
451
+ performance improvement to other kinds of PersistentVolumeClaims, as explained in detail
452
+ below.
453
+ {{< /note >}}
444
454
445
455
By default, the container runtime recursively assigns SELinux label to all
446
456
files on all Pod volumes. To speed up this process, Kubernetes can change the
@@ -451,7 +461,9 @@ To benefit from this speedup, all these conditions must be met:
451
461
452
462
* The [feature gates](/docs/reference/command-line-tools-reference/feature-gates/) `ReadWriteOncePod`
453
463
and `SELinuxMountReadWriteOncePod` must be enabled.
454
- * Pod must use PersistentVolumeClaim with `accessModes: ["ReadWriteOncePod"]`.
464
+ * Pod must use PersistentVolumeClaim with applicable `accessModes` and [feature gates](/docs/reference/command-line-tools-reference/feature-gates/):
465
+ * Either the volume has `accessModes: ["ReadWriteOncePod"]`, and feature gate `SELinuxMountReadWriteOncePod` is enabled.
466
+ * Or the volume can use any other access modes and both feature gates `SELinuxMountReadWriteOncePod` and `SELinuxMount` must be enabled.
455
467
* Pod (or all its Containers that use the PersistentVolumeClaim) must
456
468
have `seLinuxOptions` set.
457
469
* The corresponding PersistentVolume must be either:
@@ -465,15 +477,6 @@ runtime recursively changes the SELinux label for all inodes (files and directo
465
477
in the volume.
466
478
The more files and directories in the volume, the longer that relabelling takes.
467
479
468
- {{< note >}}
469
- <!-- remove after Kubernetes v1.30 is released -->
470
- If you are running Kubernetes v1.25, refer to the v1.25 version of this task page :
471
- [Configure a Security Context for a Pod or Container](https://v1-25.docs.kubernetes.io/docs/tasks/configure-pod-container/security-context/) (v1.25).
472
- There is an important note in that documentation about a situation where the kubelet
473
- can lose track of volume labels after restart. This deficiency has been fixed
474
- in Kubernetes 1.26.
475
- {{< /note >}}
476
-
477
480
# # Discussion
478
481
479
482
The security context for a Pod applies to the Pod's Containers and also to
0 commit comments