You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -402,6 +408,13 @@ To address this, we will propose a new field to `MemorySwap` called `NoSwap`. Th
402
408
403
409
This can address existing use cases where `--fail-swap-on=false` in cgroupv1 and still allow us to turn this feature on.
404
410
411
+
#### Exhausting swap resource
412
+
413
+
In previous releases of Swap, we had an `UnlimitedSwap` option for workloads.
414
+
This can cause problems where workloads can use up all swap.
415
+
If all swap is used up on a node, it can make the node go unhealthy.
416
+
To avoid exhausting swap on a node, `UnlimitedSwap` was dropped from the API in beta2.
417
+
405
418
#### Security risk
406
419
407
420
Enabling swap on a system without encryption poses a security risk, as critical information, such as Kubernetes secrets, may be swapped out to the disk. If an unauthorized individual gains access to the disk, they could potentially obtain these secrets. To mitigate this risk, it is recommended to use encrypted swap. However, handling encrypted swap is not within the scope of kubelet; rather, it is a general OS configuration concern and should be addressed at that level. Nevertheless, it is essential to provide documentation that warns users of this potential issue, ensuring they are aware of the potential security implications and can take appropriate steps to safeguard their system.
@@ -410,6 +423,11 @@ To guarantee that system daemons are not swapped, the kubelet must configure the
410
423
411
424
Additionally, end user may decide to disable swap completely for a Pod or a container in beta 1 by making Pod guaranteed or set request == limit for a container. This way, there will be no swap enabled for the corresponding containers and there will be no information exposure risks.
412
425
426
+
#### Cgroupv1 support
427
+
428
+
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.
429
+
Therefore, this feature is limited to cgroupv2 only. The main goal is to deprecate cgroupv1 eventually so this should not be a major inconvience.
430
+
413
431
## Design Details
414
432
415
433
We summarize the implementation plan as following:
@@ -435,7 +453,7 @@ Swap can be enabled as follows:
435
453
1. Enable the `NodeSwap` feature flag on the kubelet,
436
454
1. Set `--fail-on-swap` flag to `false`, and
437
455
1. (Optional) Allow Kubernetes workloads to use swap by setting
438
-
`MemorySwap.SwapBehavior` to either `LimitedSwap` or `UnlimitedSwap` in the kubelet config.
456
+
`MemorySwap.SwapBehavior` to `LimitedSwap` in the kubelet config.
439
457
440
458
### API Changes
441
459
@@ -461,7 +479,6 @@ type MemorySwapConfiguration struct {
461
479
// Configure swap memory available to container workloads. May be one of
462
480
// "", "NoSwap": workload will not use swap
463
481
// "LimitedSwap": workload combined memory and swap usage cannot exceed pod memory limit
464
-
// "UnlimitedSwap": workloads can use unlimited swap, up to the allocatable limit.
465
482
SwapBehaviorstring
466
483
}
467
484
```
@@ -477,12 +494,9 @@ container specification for the `--memory-swap` flag. Thus, the
477
494
* With cgroups v2, swap is configured independently from memory. Thus, the
478
495
container runtimes can set [`memory.swap.max`] to 0 in this case, and _no_ swap
479
496
usage will be permitted.
480
-
* If `SwapBehavior` is set to `"UnlimitedSwap"`, the container is allowed to
481
-
use unlimited swap, up to the maximum amount available on the host system.
482
497
* If `SwapBehavior` is set to `""` or `"NoSwap"`, no workloads will utilize swap.
0 commit comments