<p>I have an EKS cluster provisioned with a Terraform EKS module. When I exceeded the available pod count, the autoscaling kicked in and gave me an extra instance, which was expected.
Then I decided to change the instance type as I needed a more CPU oriented one. I changed the instance type in the module and applied changes.</p>
<p>I expected terraform to create the new node group and its workers first, then drain the old ones onto the new ones to keep the pods up, but what happened was that all the workers got destroyed and then provisioned again causing a few minutes of downtime.</p>
<p>How would I go about changing the instance type via Terraform next time to keep the pods running?</p>

rippie
<p>Since node groups instance types are immutable (as mentioned in this SO <a href="https://stackoverflow.com/a/61039596/3833773">answer</a>) Terraform is probably deleting the node group and recreating it, deleting all of the pods they are running in the process.</p>
<p>In order to avoid it, you will have to -</p>
<ol>
<li>Add a new node groups with the new instance type</li>
<li>Cordon and drain all nodes in the old node groups gradually and make sure they are scheduled as expected on the new node groups</li>
<li>Once all pods are scheduled on the new node groups, delete the old one.</li>
</ol>
