Question

Is it possible to enable swap for Kubernetes nodes?

There doesn’t seem to be an option to choose a distribution when setting up a node pool, which is understandable, as I’m sure Kubernetes has special requirements. But it seems that you can’t SSH into Kubernetes nodes, which again is understandable as that’s the point of Kubernetes and especially managed Kubernetes.

So I suspect the answer to my question is no. But it seems like such a simple little feature that could lead to more robust workloads and clusters.

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Maybe one day it may be coming, it’s alpha on the k8s v1.22:

https://kubernetes.io/blog/2021/08/09/run-nodes-with-swap-alpha/

That’s good to know that it’s not officially supported yet, thank you.

However, it’s hard to take your question seriously. I can only take it to mean that your primary concern is for DO sales. Swap memory is such a fundamental concept in computing and has such a myriad of use cases that the only reason I can think that you would ask what workloads I might need it for is that DO would rather not lose the economic opportunity of customers solving their memory needs with profit making RAM. I’m sorry to be so cynical.

You didn’t need to frame your question like that. You could have simply said that DO appreciates the value of Swap but has yet to implement it in a reliable manner. I would have been satisfied with that answer.

But to spell it out: Swap is slow RAM, it replaces system crashes with infinitely preferable system slowness. It should not be a replacement for RAM but because of the profound difference between crashing and slowness I can not think of single situation where Swap should not be enabled by default on a system.

Hi,

Any news on that matter? I’m having a similar problem where my GitLab runner is killed because of heavy needs for RAM by webpack minification during the build. Having a BIG node for running 4 project builds per day is not very cost-effective :D So I would love to see some optional swap on k8s nodes. I hope it is something easy to do and one day we will see it.

Best regards Piotr