Destroying the cluster's resources
First, you should delete the ingress-nginx
service to instruct AWS to destroy the NLB associated with the ingress controller. This step is required because terraform will fail to destroy this NLB because it has been created by Kubernetes:
$ kubectl -n nginx-ingress delete svc nginx-ingress
Then, you can follow the rest of the instructions in the Destroying the network and cluster infrastructure section in Chapter 3, Building and Provisioning Kubernetes Clusters, to destroy the Kubernetes cluster and all related AWS resources. Please ensure that the resources are destroyed in the following order:
- Kubernetes cluster
packtclusters
resources - Cluster VPC resources
- Terraform shared state resources
By executing the previous steps, all Kubernetes and AWS infrastructure resources should be destroyed and cleaned up ahead of the hands-on practice in the next chapter.