Is it possible to enable swap for Kubernetes nodes?

Posted June 18, 2019 3.2k views

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.

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.

3 answers


Thanks for the feedback. I in no way meant to assume that swap wasn’t convenient or at times necessary on a Linux system. I spent many years as a sysadmin and now lead product for DOKS, so I was framing it to try to understand your specific use case so that I could potentially work it in to our roadmap (as an option during cluster creation). Having your feedback about use case would make it easier for me to sell to the engineering team. I definitely did not have money in mind, but performance. In a lot of cases on a high performance system you’d want to evict a workload or scale your cluster to ensure top performance as opposed to extensive monitoring on swap usage or slow responses. Thanks for your feedback, I will run it by the team and update this when I have more information.


Hi Tom,

Thanks for your question! At this time we do not enable swap on DOKS worker nodes. Can you explain a bit more about what types of workloads you would like to run that would utilize swap instead of more memory?

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.

Submit an Answer