- Initialize the Project Run the following command to initialize the project:
tofu init- Plan the Changes Generate an execution plan to preview the changes
tofu plan- Create the EKS cluster and Karpenter Only If the plan looks correct, apply the changes to deploy the resources: (take aproximatly 10 to 15 minutes.)
tofu apply -target="module.vpc" -target="module.eks" -target="module.karpenter" -target="helm_release.karpenter" -target="kubectl_manifest.karpenter_node_class" -target="kubectl_manifest.karpenter_node_pool"- Apply all the changes (5 to 10 minutes ) If the Karpenter Install runs well, continue.
tofu apply- Update you kubectl config After apple the tofu configuration, update you kubeconfig to allow the usage of kubectl command and other utilities.
aws eks update-kubeconfig --region us-east-1 --name my-test-cluster --alias my-test-clusterTo destroy the resources created by the project, execute:
tofu destroyFollow these steps to clean up resources using aws-nuke:
- Install
aws-nuke: Install the tool via Homebrew:
brew install aws-nuke- Configure
nuke-example.yaml:
- Add your AWS account ID to the configuration file.
- Specify any IAM users or resources you want to exclude from deletion.
- Run
aws-nuke: Execute the following command to clean up resources:
aws-nuke nuke -c nuke-example.yaml --no-dry-runImportant: Ensure your AWS account has an active account alias before running aws-nuke to avoid errors.