Search code examples
terraformazure-aksterraform-provider-azureswapfilevirtual-machine-scale-set

Custom Node Configuration in AKS using Terraform


I wanted to create noodpool with swap memory enabled in AKS, I have gone through Terraform documentation there I can see swap_file_size_mb and vm_swappiness are the only thing related to swap. My question is

  1. is there any way to use this flag --fail-swap-on to false(or it will automatically set to false when we set swap_file_size_mb)
  2. And is there any way to change MemorySwap.SwapBehavior to "UnlimitedSwap"

Are these things are possible in AKS, or Am I missing something, I want a working node that has swap memory and should use for workload through terraform. Any suggestion appreciated. Thanks.


Solution

    1. there is a kubelet_config block in AKS schema that allows settings failSwapOn: https://learn.microsoft.com/en-us/azure/aks/custom-node-configuration#virtual-memory

    but that one is not exposed in terraform, but i think its hardcoded to false: https://github.com/hashicorp/terraform-provider-azurerm/blob/ddd6a9e2ef99f2e859b567badbed1aa829261caa/internal/services/containers/kubernetes_cluster_node_pool_resource.go#L1020

    1. MemorySwap - i dont think so, at least I dont see it in the docs: https://learn.microsoft.com/en-us/azure/aks/custom-node-configuration#virtual-memory