|
31 | 31 | - [Exhausting swap resource](#exhausting-swap-resource)
|
32 | 32 | - [Security risk](#security-risk)
|
33 | 33 | - [Cgroupv1 support](#cgroupv1-support)
|
| 34 | + - [Memory-backed volumes](#memory-backed-volumes) |
34 | 35 | - [Design Details](#design-details)
|
35 | 36 | - [Enabling swap as an end user](#enabling-swap-as-an-end-user)
|
36 | 37 | - [API Changes](#api-changes)
|
@@ -478,6 +479,25 @@ Additionally, end user may decide to disable swap completely for a Pod or a cont
|
478 | 479 | In the early release of this feature, there was a goal to support cgroup v1. As the feature progressed, sig-node realized that supporting swap with cgroup v1 would be very difficult.
|
479 | 480 | Therefore, this feature is limited to cgroupv2 only. The main goal is to deprecate cgroupv1 eventually so this should not be a major inconvience.
|
480 | 481 |
|
| 482 | +#### Memory-backed volumes |
| 483 | + |
| 484 | +Kubernetes guarantees that some volumes' memory would never reside on disk, e.g. Secrets, memory-backed emptyDirs, etc. |
| 485 | +Behind the scenes, Kubelet mounts such volumes as tmpfs volumes on the host. |
| 486 | + |
| 487 | +To address this risk, if `--fail-swap-on=false`, the [tmpfs noswap option](https://www.kernel.org/doc/html/latest/filesystems/tmpfs.html) |
| 488 | +will be used in order to prevent the volumes' pages from swapping to disk. |
| 489 | + |
| 490 | +Bear in mind that the tmpfs noswap option is fairly new and is supported in kernel versions >= 6.4. However, different |
| 491 | +Linux distributions can decide to backport this options to older versions of the kernel. Therefore, when |
| 492 | +`--fail-swap-on=false` is being provided on a node: |
| 493 | +* If the kernel version equals or is above 6.4, the tmpfs noswap option is being used when necessary. |
| 494 | +* Else, kubelet would try to mount a dummy volume with the tmpfs noswap option to understand whether the option is |
| 495 | + backported. If the mount succeeds, the tmpfs noswap option is being used when necessary. |
| 496 | +* Else, kubelet would raise a warning about the option not being supported and the possible risk. |
| 497 | + |
| 498 | +In the longer term, when this option would be very widely supported, this would no longer be a concern, hence this logic |
| 499 | +could be dropped. |
| 500 | + |
481 | 501 | ## Design Details
|
482 | 502 |
|
483 | 503 | We summarize the implementation plan as following:
|
|
0 commit comments