The resources can be cleaned up using following steps:
(a) Remove the EKS Services:
First connect to the kubernetes cluster using command published as "ConfigCommand" under CloudFormation output. Run "kubectl get svc" to check if you can see the Blue and Green services. Then run the below commands to delete the services.
kubectl delete svc/flask-svc-alb-blue svc/flask-svc-alb-green -n flask-alb kubectl delete deploy/flask-deploy-alb-blue deploy/flask-deploy-alb-green -n flask-alb kubectl delete ingress alb-ingress -n flask-alb kubectl delete deploy alb-ingress-controller -n kube-system
(b) Destroy the CDK Stack:
Ensure you are in the cdk directory and then run the below command:
(c ) Remove the individual created policies:
Access IAM Service, then access Roles, then select the Worker Node Instance role (search by CdkStackALBEksBg-ClusterDefaultCapacityInstanceRol) and then remove the inline elb-policy
Access IAM Service, then access Policies, then select "alb-ingress-controller" managed policy created for kubectl, then Select Policy Actions and Delete
(d) Cleanup the Jenkins Infrastructure: Select the CloudFormation template that spawned Jenkins infrastructure and click Delete.