Skip to content

Delete EKS Cluster & Node Groups

Step-01: Delete Node Group

  • We can delete a nodegroup separately using below eksctl delete nodegroup
    # List EKS Clusters
    eksctl get clusters
    # Capture Node Group name
    eksctl get nodegroup --cluster=<clusterName>
    eksctl get nodegroup --cluster=eksdemo1
    # Delete Node Group
    eksctl delete nodegroup --cluster=<clusterName> --name=<nodegroupName>
    eksctl delete nodegroup --cluster=eksdemo1 --name=eksdemo1-ng-public1

Step-02: Delete Cluster

  • We can delete cluster using eksctl delete cluster
    # Delete Cluster
    eksctl delete cluster <clusterName>
    eksctl delete cluster eksdemo1

AWS EKS - Elastic Kubernetes Service - Masterclass


Important Notes

Note-1: Rollback any Security Group Changes

  • When we create a EKS cluster using eksctl it creates the worker node security group with only port 22 access.
  • When we progress through the course, we will be creating many NodePort Services to access and test our applications via browser.
  • During this process, we need to add an additional rule to this automatically created security group, allowing access to our applications we have deployed.
  • So the point we need to understand here is when we are deleting the cluster using eksctl, its core components should be in same state which means roll back the change we have done to security group before deleting the cluster.
  • In this way, cluster will get deleted without any issues, else we might have issues and we need to refer cloudformation events and manually delete few things. In short, we need to go to many places for deletions.

Note-2: Rollback any EC2 Worker Node Instance Role - Policy changes

  • When we are doing EBS Storage Section with EBS CSI Driver we will add a custom policy to worker node IAM role.
  • When you are deleting the cluster, first roll back that change and delete it.
  • This way we don't face any issues during cluster deletion.