Skip to content

Commit b5fc3c9

Browse files
author
Michael Burke
committed
Nodes fix swap memory part 2
1 parent 2a8fe4f commit b5fc3c9

File tree

1 file changed

+24
-18
lines changed

1 file changed

+24
-18
lines changed

modules/nodes-nodes-swap-memory.adoc

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,44 @@
11
// Module included in the following assemblies:
22
//
3-
// * nodes/nodes/nodes-nodes-managing.:_mod-docs-content-type: PROCEDURE
3+
// * nodes/nodes/nodes-nodes-managing.adoc
44

55
:_mod-docs-content-type: PROCEDURE
66
[id="nodes-nodes-swap-memory_{context}"]
77

8-
= Enabling swap memory use on nodes
8+
= Allowing swap memory use on nodes
99

10-
:FeatureName: Enabling swap memory use on nodes
10+
You can allow workloads on the cluster nodes to use swap memory.
11+
12+
:FeatureName: Swap memory support on nodes
1113
include::snippets/technology-preview.adoc[]
1214

1315
[NOTE]
1416
====
15-
Enabling swap memory is only available for container-native virtualization (CNV) users or use cases.
17+
Swap memory support is available only for container-native virtualization (CNV) users or use cases.
1618
====
1719

18-
[WARNING]
19-
====
20-
Enabling swap memory can negatively impact workload performance and out-of-resource handling. Do not enable swap memory on control plane nodes.
21-
====
20+
To allow swap memory usage on your nodes, create a `kubeletconfig` custom resource (CR) to set the `failSwapOn` parameter to `false`.
2221

23-
To enable swap memory, create a `kubeletconfig` custom resource (CR) to set the `swapbehavior` parameter. You can set limited or unlimited swap memory:
22+
Optionally, you can control swap memory usage by {product-title} workloads on those nodes by setting the `swapBehavior` parameter to one of the following values:
2423

25-
* Limited: Use the `LimitedSwap` value to limit how much swap memory workloads can use. Any workloads on the node that are not managed by {product-title} can still use swap memory. The `LimitedSwap` behavior depends on whether the node is running with Linux control groups link:https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v1/index.html[version 1 (cgroups v1)] or link:https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html[version 2 (cgroup v2)]:
26-
** cgroup v1: {product-title} workloads can use any combination of memory and swap, up to the pod's memory limit, if set.
27-
** cgroup v2: {product-title} workloads cannot use swap memory.
24+
* `NoSwap` prevents {product-title} worloads from using swap memory.
25+
* `LimitedSwap` allows {product-title} workloads that fall under the Burstable QoS class to use swap memory.
2826

29-
* Unlimited: Use the `UnlimitedSwap` value to allow workloads to use as much swap memory as they request, up to the system limit.
27+
Regardless of the `swapBehavior` setting, any workloads that are not managed by {product-title} on that node can still use swap memory if the `failSwapOn` parameter is `false`.
3028

31-
Because the kubelet will not start in the presence of swap memory without this configuration, you must enable swap memory in {product-title} before enabling swap memory on the nodes. If there is no swap memory present on a node, enabling swap memory in {product-title} has no effect.
29+
Because the kubelet will not start in the presence of swap memory without this configuration, you must allow swap memory in {product-title} before enabling swap memory on the nodes. If there is no swap memory present on a node, enabling swap memory in {product-title} has no effect.
30+
31+
[WARNING]
32+
====
33+
Using swap memory can negatively impact workload performance and out-of-resource handling. Do not enable swap memory on control plane nodes.
34+
====
3235

3336
.Prerequisites
3437

3538
* You have a running {product-title} cluster that uses version 4.10 or later.
3639

40+
* Your cluster is configured to use cgroup v2. Swap memory is not supported on nodes in clusters that use cgroup v1.
41+
3742
* You are logged in to the cluster as a user with administrative privileges.
3843

3944
* You have enabled the `TechPreviewNoUpgrade` feature set on the cluster (see _Nodes -> Working with clusters -> Enabling features using feature gates_).
@@ -43,8 +48,6 @@ Because the kubelet will not start in the presence of swap memory without this c
4348
Enabling the `TechPreviewNoUpgrade` feature set cannot be undone and prevents minor version updates. These feature sets are not recommended on production clusters.
4449
====
4550

46-
* If cgroup v2 is enabled on a node, you must enable swap accounting on the node, by setting the `swapaccount=1` kernel argument.
47-
4851
.Procedure
4952

5053
. Apply a custom label to the machine config pool where you want to allow swap memory.
@@ -73,6 +76,9 @@ spec:
7376
#...
7477
----
7578
<1> Set to `false` to enable swap memory use on the associated nodes. Set to `true` to disable swap memory use.
76-
<2> Specify the swap memory behavior. If unspecified, the default is `LimitedSwap`.
79+
<2> Optional: Specify the swap memory behavior for {product-title} pods.
80+
+
81+
* `NoSwap`: {product-title} pods cannot use swap. This is the default.
82+
* `LimitedSwap`: {product-title} pods of Burstable QoS class only are permitted to employ swap.
7783

78-
. Enable swap memory on the machines.
84+
. Enable swap memory on the nodes by setting the `swapaccount=1` kernel argument and configure swap memory as needed.

0 commit comments

Comments
 (0)