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
You can allow workloads on the cluster nodes to use swap memory.
11
+
12
+
:FeatureName: Swap memory support on nodes
11
13
include::snippets/technology-preview.adoc[]
12
14
13
15
[NOTE]
14
16
====
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.
16
18
====
17
19
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`.
22
21
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:
24
23
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.
28
26
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`.
30
28
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
+
====
32
35
33
36
.Prerequisites
34
37
35
38
* You have a running {product-title} cluster that uses version 4.10 or later.
36
39
40
+
* Your cluster is configured to use cgroup v2. Swap memory is not supported on nodes in clusters that use cgroup v1.
41
+
37
42
* You are logged in to the cluster as a user with administrative privileges.
38
43
39
44
* 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
43
48
Enabling the `TechPreviewNoUpgrade` feature set cannot be undone and prevents minor version updates. These feature sets are not recommended on production clusters.
44
49
====
45
50
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
-
48
51
.Procedure
49
52
50
53
. Apply a custom label to the machine config pool where you want to allow swap memory.
@@ -73,6 +76,9 @@ spec:
73
76
#...
74
77
----
75
78
<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.
77
83
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