Below are steps to upgrade the nodes in the AWS ESK CLuster:
1. Check the available updates
- FInd the latest AMI ID’s: AWS publishes optimized AMIs for EKS regularly. You can find the latest AMI IDs on the Amazon EKS optimized AMI page.
- Note the AMI ID that matches your Kubernetes version.
2. Update the Launch Template or Launch Configuration:
- Update Launch Template (for Managed Node Groups):
- Go to the EC2 console
- Navigate to “Launch Templates” and find the one used by your EKS node group.
- Create a new version of the launch template with the updated AMI ID.
- Update Launch Configuration (for Self-Managed Node Groups):
- Go to the EC2 console.
- Navigate to “Launch Configurations” and create a new launch configuration with the updated AMI ID.
3. Update Managed Node Group:
1.For managed node groups, update the node group to use the new launch template version.
aws eks update-nodegroup-version --cluster-name <cluster-name> --nodegroup-name <nodegroup-name> --launch-template name=<launch-template-name>,version=<version>
4. Drain and Terminate Old Nodes:
1. Drain Nodes:
- Use
kubectl
to drain the nodes. This will safely evict pods from the nodes.
kubectl drain <node-name> --ignore-daemonsets --delete-emptydir-data
2. Terminate Nodes:
- Terminate the old nodes from the EC2 console or using AWS CLI.
- If using managed node groups, you can update the desired capacity to remove old nodes.
5. Verify and Clean Up
- Verify New Nodes:
- Ensure new nodes are joining the cluster and that pods are being scheduled correctly.
- Use
kubectl get nodes
to check node status. - Use
kubectl get pods -o wide
to ensure pods are running on new nodes.
- Clean Up:
- Delete old launch configurations or unused resources if no longer needed.
- Ensure autoscaling policies are set correctly for the new nodes.