Sometimes we need to drain nodes in Kubernetes. When I manually set up a k8s cluster, I can drain the specific node then terminate that machine. While in EKS, nodes are under auto scaling group, which means I can't terminate a specific instance(node). If I manually terminate a instance, another instance(node) will be automatically added into eks cluster.
So is there any suggested method to drain a node in EKS?
kubectl drain
will drain a Node, ASG or not. Terminating an instance will effectively drain it, although not in the way you'd like. And yes, adding instances in place of other instances sounds like what an ASG was designed to do. If you don't want a replacement, perhaps scale the ASG down to prevent that behavior?node-1
drained and terminated, and the steps I outlined will 100% do that. But the other half of your question is somehow related to the sizing of the ASG (which is not related to draining anything). Please do consider updating your question to be more specific.