Teardown
Reuse the same exports from Prerequisites (CLUSTER_NAME, AWS_REGION, AWS_PROFILE, LAB_DIR, and Argo CD vars if you created the capability).
export AWS_PROFILE=sandboxexport AWS_PAGER=""export AWS_REGION=ap-southeast-2export AWS_DEFAULT_REGION="$AWS_REGION"export CLUSTER_NAME=kueue-labexport LAB_DIR="$(pwd)/demo" # from repo root; or export LAB_DIR="$(pwd)" if already in demo/export ARGOCD_CAPABILITY_NAME=lab-argocdexport ARGOCD_ROLE_NAME=ArgoCDCapabilityRoleWork from demo/:
cd "$LAB_DIR"Stop KueueViz port-forwards if they are still running:
pkill -f 'port-forward.*kueueviz' 2>/dev/null || trueRemove batch work and Kueue
Section titled “Remove batch work and Kueue”Delete Jobs first so Auto Mode can drain Spot nodes, then remove queues, the NodePool, and the Argo CD Application:
kubectl delete jobs -n project-a --all --ignore-not-foundkubectl delete jobs -n project-b --all --ignore-not-foundkubectl delete jobs -n project-c --all --ignore-not-found
kubectl delete -f examples/kueue/queues.yaml --ignore-not-foundkubectl delete -f examples/kueue/batch-nodepool.yaml --ignore-not-foundkubectl delete -f examples/argocd/kueue-application.yaml --ignore-not-foundkubectl delete -f examples/argocd/in-cluster-secret.yaml --ignore-not-found
# Helm/Application usually removes kueue-system; force if neededkubectl delete namespace kueue-system --ignore-not-found --wait=falseIf a manifest file is missing, delete by name instead:
kubectl delete application kueue -n argocd --ignore-not-foundkubectl delete secret in-cluster -n argocd --ignore-not-foundkubectl delete clusterqueue shared-batch --ignore-not-foundkubectl delete resourceflavor spot on-demand --ignore-not-foundkubectl delete nodepool batch --ignore-not-foundkubectl delete namespace project-a project-b project-c --ignore-not-foundDelete Argo CD capability
Section titled “Delete Argo CD capability”If you created the lab capability:
export ARGOCD_ROLE_ARN="arn:aws:iam::$(aws sts get-caller-identity --query Account --output text):role/${ARGOCD_ROLE_NAME}"
aws eks disassociate-access-policy \ --cluster-name "$CLUSTER_NAME" \ --principal-arn "$ARGOCD_ROLE_ARN" \ --policy-arn arn:aws:eks::aws:cluster-access-policy/AmazonEKSClusterAdminPolicy \ --region "$AWS_REGION" 2>/dev/null || true
eksctl delete capability -f config/argocd-capability.yaml
# wait until gone (eksctl has no --wait on delete capability)while eksctl get capability --cluster "$CLUSTER_NAME" --region "$AWS_REGION" 2>/dev/null | grep -q lab-argocd; do echo "waiting for capability delete..." sleep 15done
# Role may already be gone if CloudFormation removed it with the capability stackaws iam delete-role --role-name "$ARGOCD_ROLE_NAME" 2>/dev/null || trueIf config/argocd-capability.yaml is gone, delete by name:
eksctl delete capability \ --cluster "$CLUSTER_NAME" \ --name "$ARGOCD_CAPABILITY_NAME" \ --region "$AWS_REGION"This lab attaches no extra IAM policies to ArgoCDCapabilityRole. delete-role returning NoSuchEntity after a successful capability delete is fine.
Destroy cluster
Section titled “Destroy cluster”eksctl delete cluster -f config/cluster.yaml --waitIf the file is missing:
eksctl delete cluster --name "$CLUSTER_NAME" --region "$AWS_REGION" --waitConfirm the cluster is gone:
aws eks describe-cluster --name "$CLUSTER_NAME" --region "$AWS_REGION" 2>&1 | headExpect ResourceNotFoundException.