-
Notifications
You must be signed in to change notification settings - Fork 39.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[KEP-2400] Mount tmpfs memory-backed volumes with a noswap option if supported #124060
Conversation
/triage accepted |
@iholder101 Can we make the commits purely additive? |
a66c5be
to
819356e
Compare
use the tmpfs noswap option in order to mount memory-backed volumes if it's supported. Signed-off-by: Itamar Holder <iholder@redhat.com>
Signed-off-by: Itamar Holder <iholder@redhat.com>
Signed-off-by: Itamar Holder <iholder@redhat.com>
Signed-off-by: Itamar Holder <iholder@redhat.com>
When --fail-swap-on=false kubelet CLI argument is provided, but tmpfs noswap is not supported by the kernel, warn about the risks of memory-backed volumes being swapped into disk Signed-off-by: Itamar Holder <iholder@redhat.com>
Signed-off-by: Itamar Holder <iholder@redhat.com>
Signed-off-by: Itamar Holder <iholder@redhat.com>
819356e
to
a6b971f
Compare
@mrunalp Definitely. PTAL |
@iholder101: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dims, iholder101, kwilczynski, mrunalp The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/lgtm great work here! |
LGTM label has been added. Git tree hash: 7ee51bea411226326f5247a0081b6e8681284089
|
Thank you everyone for your fruitful reviews! Unholding based on #124060 (comment) |
What type of PR is this?
/kind feature
What this PR does / why we need it:
This PR addresses #105978 which is about preventing memory-backed volumes from being swapped.
This PR brings the following behavior:
fail-swap-on=false
argument, it will check if the tmpfs noswap option is supported. If it's not - a warning log will be raised.[1] https://www.kernel.org/doc/html/latest/filesystems/tmpfs.html
Example
After running kubelet with the
--fail-swap-on=false
argument, I've created the following pod and secret:Then on the node we can see tmpfs noswap being used:
> grep noswap /proc/mounts tmpfs /var/lib/kubelet/pods/a79290c3-8565-4d05-b065-e6fe3d471beb/volumes/kubernetes.io~projected/kube-api-access-dfw72 tmpfs rw,seclabel,relatime,size=51200k,inode64,noswap 0 0 tmpfs /var/lib/kubelet/pods/1b756da6-531f-40d0-aa44-df79de14ad04/volumes/kubernetes.io~projected/kube-api-access-gh9tk tmpfs rw,seclabel,relatime,size=394492600k,inode64,noswap 0 0 tmpfs /var/lib/kubelet/pods/1fe60428-4258-481a-99b6-bdc4ae671c71/volumes/kubernetes.io~empty-dir/my-volume tmpfs rw,seclabel,relatime,size=524288k,inode64,noswap 0 0 tmpfs /var/lib/kubelet/pods/1fe60428-4258-481a-99b6-bdc4ae671c71/volumes/kubernetes.io~secret/secret-volume tmpfs rw,seclabel,relatime,size=524288k,inode64,noswap 0 0 tmpfs /var/lib/kubelet/pods/1fe60428-4258-481a-99b6-bdc4ae671c71/volumes/kubernetes.io~projected/kube-api-access-sfr4d tmpfs rw,seclabel,relatime,size=524288k,inode64,noswap 0 0
Which issue(s) this PR fixes:
Fixes #105978
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:
Note: I keep the functest and its revert commit for future reference, as in the future it would be a great candidate for a functional test (when noswap is widely supported enough)
/sig node