Destroying the cluster
First, you should delete the ingress-nginx
service to instruct AWS to destroy the NLB associated with the ingress controller. We need this step because Terraform will fail to destroy this NLB because it is created by Kubernetes:
$ kubectl -n nginx-ingress destroy svc nginx-ingress
Then, you can follow the rest of the instructions in the Destroying the network and cluster infrastructure section in Chapter 3, Provisioning Kubernetes Clusters Using AWS and Terraform, 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, you should have all Kubernetes and AWS infrastructure resources destroyed and cleaned up, ready for the hands-on practice in the next chapter.