Cleanup
About this task
All resources provisioned during this setup or demonstration can be systematically dismantled to ensure complete cleanup.
Procedure
To remove all the resources created during this exercise, run the following
commands in the specified order:
# Uninstall Link chart
helm uninstall lnk-prod
# Delete all manually provisioned PVCs and PVs
kubectl delete pvc link-files-pvc
kubectl delete pv link-files-pv
kubectl delete pvc link-data-pvc
kubectl delete pv link-data-pv
kubectl delete pvc link-redis-pvc
kubectl delete pv link-redis-pv
kubectl delete pvc link-mongodb-pvc
kubectl delete pv link-mongodb-pv
# Delete EFS mount targets from all subnets
for mount_target in $(aws efs describe-mount-targets \
--file-system-id $EFS_FS_ID \
--region $AWS_REGION \
--query 'MountTargets[].MountTargetId' \
--output text); \
do aws efs delete-mount-target --mount-target-id $mount_target; done
# Wait for 45 seconds for the deletion process to complete
sleep 45
# Delete EFS (if it does not get deleted, wait for another minute and try again)
aws efs delete-file-system --file-system-id $EFS_FS_ID --region $AWS_REGION
# Delete EFS security group
aws ec2 delete-security-group --group-id $EFS_SG_ID --region $AWS_REGION
# Delete the EKS cluster (takes about 3 minutes)
eksctl delete cluster $CLUSTER_NAME --region $AWS_REGION