I’m managing my cluster using the eks module and managed node groups. I would like to try the beta swap memory feature of kubernetes through terraform if possible.
The feature allows kubernetes to use swap memory on worker nodes. After creating swap space on a node, via kubelet config json:
and after restarting kubelet, it’s expected to work.
I couldn’t find a way to enable this feature using the eks module, I can ssh into a node and do everything to manually enable it but obviously if node gets replaced during scale up or down, it will be lost.
Currently, the EKS Terraform module does not support configuring kubelet parameters like enabling swap directly. To enable this feature, you have two main options:
Use a Launch Template with Custom User Data
Attach a launch template to your managed node group. In the user data of the launch template, include the necessary commands to configure the swap space and kubelet settings. Example: