Kubernetes Node Recycle
Recycling nodes in Kubernetes is quite easy (given there is enough capacity to deal with the Pods of the old Node) 🤓
Commands the need to do:
kubectl cordon ${NODE_NAME}
kubectl drain --ignore-daemonsets --delete-local-data ${NODE_NAME}
kubectl delete node ${NODE_NAME}
Once the Kubernetes delete is done, if you use AWS EC2 instances to host the Nodes as we do, you will have to go to the ASG you have defined and then un-attach and destroy that EC2 instance.
For example, you could do the following command in a for
loop to upgrade your Kubernetes cluster with a new AMI image for your Node.
Thank you for reading! 👋
If you notice any mistakes please contact me on Twitter.