Cleanup

Namespace deletion may take few minutes, please wait till the process completes.

Delete Product Catalog apps

kubectl delete namespace prodcatalog-ns

Delete ECR images

aws ecr delete-repository --repository-name eks-app-mesh-demo/catalog_detail --force
aws ecr delete-repository --repository-name eks-app-mesh-demo/frontend_node --force
aws ecr delete-repository --repository-name eks-app-mesh-demo/product_catalog --force

(Only if you enabled for this workshop) Disable Amazon EKS Control Pane Logs

eksctl utils update-cluster-logging --disable-types all \
    --region ${AWS_REGION} \
    --cluster eksworkshop-eksctl \
    --approve

Delete Cloudwatch namespace

kubectl delete namespace amazon-cloudwatch

Delete Observability namespace

kubectl delete namespace aws-observability

Delete the Product Catalog mesh

kubectl delete meshes prodcatalog-mesh

Uninstall the Helm Charts

helm -n appmesh-system delete appmesh-controller

Delete AWS App Mesh CRDs

for i in $(kubectl get crd | grep appmesh | cut -d" " -f1) ; do
kubectl delete crd $i
done

Delete the AppMesh Controller service account

eksctl delete iamserviceaccount  --cluster eksworkshop-eksctl --namespace appmesh-system --name appmesh-controller

Delete the AWS App Mesh namespace

kubectl delete namespace appmesh-system

Delete Fargate Logging Policy

export PodRole=$(aws eks describe-fargate-profile --cluster-name eksworkshop-eksctl --fargate-profile-name fargate-productcatalog --query 'fargateProfile.podExecutionRoleArn' | sed -n 's/^.*role\/\(.*\)".*$/\1/ p')
aws iam detach-role-policy \
        --policy-arn arn:aws:iam::${ACCOUNT_ID}:policy/FluentBitEKSFargate \
        --role-name ${PodRole}
aws iam delete-policy --policy-arn arn:aws:iam::$ACCOUNT_ID:policy/FluentBitEKSFargate

Delete Fargate profile

eksctl delete fargateprofile \
  --name fargate-productcatalog \
  --cluster eksworkshop-eksctl

Delete the policy and IRSA

eksctl delete iamserviceaccount --cluster eksworkshop-eksctl   --namespace prodcatalog-ns --name prodcatalog-envoy-proxies
aws iam delete-policy --policy-arn arn:aws:iam::$ACCOUNT_ID:policy/ProdEnvoyNamespaceIAMPolicy