Starting with Kublr Agent versions 1.27.16-2
, 1.28.15-1
, 1.29.15-1
, 1.30.11-1
, 1.31.7-1
,
1.32.3-1
and above Kublr supports swap memory use by Kubernetes.
All agents included by default in KCP 1.30.0
and above support this feature.
Swap continues to be disabled by default following Kubernetes approach, but it can be enabled via Kublr cluster specification.
Swap memory management on Kubernetes is described in Kubernetes documentation:
NodeSwap
for more informaiton on support status in different versions of Kubernetes).Kublr supports this capability by turning swap on and off before starting Kubelet based on
the cluster specification, and setting kubelet parameter failSwapOn
accordingly.
Swap can be enable by setting kublr.features.swap.system
property in Kublr agent config
to on
.
Supported values:
'off'
(default) - Kublr agent will run swapoff -a
before starting kubelet
on the node'on'
- Kublr agent will run swapon -a
before starting kubelet
on the node''
(empty string) or any other value - Kublr agent will not change swap statusAny value other than 'off'
will additionally set failSwapOn
property in kubelet
config to false
(by default the property is not set).
Example of turning swap use via cluster specification:
spec:
kublrAgentConfig:
kublr:
features:
swap:
# it is highly recommended to use quotes around the value here
# to avoid YAML 1.1 specification ambiguity due to which unquoted
# on, off, yes, no, etc values may be treated as boolean
system: 'on'
As described in Kubernetes swap memory management documentation, it can be managed via kubelet properties and feature gates.
The following example shows explicit enabling the feature gate on kubelet and setting kubelet configuration parameters:
spec:
kublrAgentConfig:
kublr:
features:
swap:
system: 'on'
kubelet_config:
featureGates:
NodeSwap: true
memorySwap:
swapBehavior: LimitedSwap