Skip to content

corndog: apply memory.min for kubelet and containerd - #1114

Draft
qianxjcraig wants to merge 2 commits into
bottlerocket-os:developfrom
qianxjcraig:br4916-memmin-20261028
Draft

qianxjcraig wants to merge 2 commits into
bottlerocket-os:developfrom
qianxjcraig:br4916-memmin-20261028

Conversation

@qianxjcraig

@qianxjcraig qianxjcraig commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Issue number:

Related: bottlerocket-os/bottlerocket#4916

Depends on bottlerocket-os/bottlerocket-settings-sdk#163.

Description of changes:
Under memory pressure on zram swap variants, kubelet and containerd memory can be reclaimed or swapped out, and kubelet stalls until the node goes NotReady. This protects both services with cgroup v2 memory.min, set by settings.kubernetes.kube-reserved-memory-min:

  • release-swap adds templates that render MemoryMin= drop-ins for kubelet.service, containerd.service and their parent runtime.slice (set to the sum of the two). Unset values render 0.
  • corndog apply-kube-reserved-memory-min applies them with systemctl set-property --runtime, so changes take effect without restarting kubelet or containerd.
  • thar-be-settings skips the services lookup when a setting's affected-services list is empty.

Variants opt in through their settings defaults. Nothing changes for variants that don't.

Results:

In lab runs that reproduce the NotReady issue (reproduction: a pod memory leak on c7i, c7g and c7a nodes with a small kube-reserved), setting kubelet and containerd to 128 MiB each kept every node Ready:

MemMin1

Testing done:
cargo test for corndog, schnauzer and thar-be-settings passes.

On an aws-k8s-1.35 t3a.medium node with this change:

Case kubelet / containerd / runtime.slice memory.min
kubelet and containerd set to 128Mi 128 / 128 / 256 MiB
Bootstrap command sets kubelet to 200Mi 200 / 128 / 328 MiB, same boot
apiclient set 200Mi / 300Mi on a running node 200 / 300 / 500 MiB, no service restart
A rendered drop-in is missing at boot 0 / 0 / 0, node still Ready

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

@qianxjcraig qianxjcraig changed the title Br4916 memmin 20261028 corndog: apply kube-reserved-memory-min to kubelet and containerd Oct 30, 2026
@qianxjcraig
qianxjcraig force-pushed the br4916-memmin-20261028 branch from 64cff93 to 6e670cb Compare October 30, 2026 05:22
@qianxjcraig qianxjcraig changed the title corndog: apply kube-reserved-memory-min to kubelet and containerd corndog: apply memory.min for kubelet and containerd Oct 30, 2026
Render memory.min drop-ins for kubelet, containerd and their parent
runtime.slice from settings.kubernetes.kube-reserved-memory-min, and
apply them with `systemctl set-property --runtime` so changes take
effect without restarting either service.

Signed-off-by: Craig Qian <qianxj@amazon.com>
This lets variants mark settings they don't use with
`affected-services = []`.

Signed-off-by: Craig Qian <qianxj@amazon.com>
@qianxjcraig
qianxjcraig force-pushed the br4916-memmin-20261028 branch from 6e670cb to fb7343d Compare October 30, 2026 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant