Teardown
Tear down billable compute first (cluster + LoadBalancer). Repos and some IAM roles are optional cleanup.
Set variables
Section titled “Set variables”export AWS_PROFILE=sandboxexport AWS_PAGER=""export AWS_REGION=ap-southeast-2export CLUSTER_NAME=cluster-1export ARGOCD_CAPABILITY_NAME=lab-argocdexport ARGOCD_ROLE_NAME=ArgoCDCapabilityRoleexport KPACK_IRSA_ROLE_NAME=cluster-1-kpack-ecrexport GIT_USER=kpack-codecommit-gitexport ECR_REPO=pulseexport CODECOMMIT_APP=pulse-appexport CODECOMMIT_DEPLOY=pulse-deployOr load the same names from the inventory: eval "$(node scripts/export-lab-env.mjs)".
Delete Applications (optional but clean)
Section titled “Delete Applications (optional but clean)”Removes GitOps-managed workloads while the capability still exists:
kubectl -n argocd delete application pulse --ignore-not-foundkubectl -n argocd delete application kpack --ignore-not-foundDelete the Argo CD capability
Section titled “Delete the Argo CD capability”Capability deletePropagationPolicy is RETAIN — delete Applications first (above), then the capability, then the cluster.
eksctl delete capability \ --cluster "$CLUSTER_NAME" \ --region "$AWS_REGION" \ --name "$ARGOCD_CAPABILITY_NAME"eksctl waits up to --timeout (default 25m). If the capability is already gone, continue.
Delete the cluster
Section titled “Delete the cluster”eksctl delete cluster --name "$CLUSTER_NAME" --region "$AWS_REGION" --waitThis removes the EKS
Amazon Elastic Kubernetes Service — this lab uses cluster name `cluster-1`. control plane, Auto Mode nodes, and the Pulse LoadBalancer. Expect roughly 10–20 minutes.
CodeCommit
AWS managed Git hosting — GitHub alternative used for app source and deploy manifests in this lab. and ECR
Amazon Elastic Container Registry — stores OCI images built by kpack; EKS pulls from here. repos are left in place by default (next section).
Optional — IAM leftovers
Section titled “Optional — IAM leftovers”eksctl delete cluster removes the kpack-sa IRSA role with the cluster stack, but the customer-managed policy, the Argo CD capability role, and the CodeCommit git user can remain:
# Customer-managed kpack ECR policy (role may already be gone)KPACK_POLICY_ARN=$(aws iam list-policies --scope Local \ --query "Policies[?PolicyName==\`${KPACK_IRSA_ROLE_NAME}-policy\`].Arn | [0]" \ --output text)if [ -n "$KPACK_POLICY_ARN" ] && [ "$KPACK_POLICY_ARN" != "None" ]; then aws iam detach-role-policy \ --role-name "$KPACK_IRSA_ROLE_NAME" \ --policy-arn "$KPACK_POLICY_ARN" 2>/dev/null || true aws iam delete-role --role-name "$KPACK_IRSA_ROLE_NAME" 2>/dev/null || true aws iam delete-policy --policy-arn "$KPACK_POLICY_ARN"fi
# Argo CD capability role (inline CodeCommit policy)aws iam delete-role-policy \ --role-name "$ARGOCD_ROLE_NAME" \ --policy-name ArgoCDCodeCommitPulseDeploy 2>/dev/null || trueaws iam delete-role --role-name "$ARGOCD_ROLE_NAME" 2>/dev/null || true
# CodeCommit HTTPS git user for kpackGIT_CRED_ID=$(aws iam list-service-specific-credentials \ --user-name "$GIT_USER" \ --query 'ServiceSpecificCredentials[0].ServiceSpecificCredentialId' \ --output text 2>/dev/null || true)if [ -n "$GIT_CRED_ID" ] && [ "$GIT_CRED_ID" != "None" ]; then aws iam delete-service-specific-credential \ --user-name "$GIT_USER" \ --service-specific-credential-id "$GIT_CRED_ID"fiaws iam detach-user-policy \ --user-name "$GIT_USER" \ --policy-arn arn:aws:iam::aws:policy/AWSCodeCommitPowerUser 2>/dev/null || trueaws iam delete-user --user-name "$GIT_USER" 2>/dev/null || trueOptional — CodeCommit and ECR
Section titled “Optional — CodeCommit and ECR”aws ecr delete-repository --repository-name "$ECR_REPO" --forceaws codecommit delete-repository --repository-name "$CODECOMMIT_APP"aws codecommit delete-repository --repository-name "$CODECOMMIT_DEPLOY"Local cleanup
Section titled “Local cleanup”rm -rf demo/.generatedrm -f demo/config/cluster.yaml demo/config/argocd-capability.yamlrm -f demo/config/iam/argocd-trust-policy.json \ demo/config/iam/argocd-codecommit-policy.jsonrmdir demo/config/iam 2>/dev/null || trueNested demo/app/.git and demo/deploy/.git stay unless you remove those trees yourself.
Verify
Section titled “Verify”aws eks describe-cluster --name "$CLUSTER_NAME" --region "$AWS_REGION"aws iam get-role --role-name "$ARGOCD_ROLE_NAME"aws iam get-role --role-name "$KPACK_IRSA_ROLE_NAME"aws iam list-policies --scope Local \ --query "Policies[?PolicyName==\`${KPACK_IRSA_ROLE_NAME}-policy\`].Arn" \ --output textaws iam get-user --user-name "$GIT_USER"aws ecr describe-repositories --repository-names "$ECR_REPO"aws codecommit list-repositories --query 'repositories[].repositoryName' --output textExpect ResourceNotFoundException / NoSuchEntity for cluster, roles, user, and ECR (if you deleted repos). The kpack policy query should print nothing. CodeCommit list should not include pulse-app / pulse-deploy if you deleted them.