Skip to content

davivcgarcia/aws-eks-sandbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Amazon EKS Sandbox

About

This repository contains infrastructure code used to bootstrap an Amazon EKS environment with the most common components and integrations enabled using Terraform.

Dependencies

Usage

  1. Clone this repository:
git clone https://github.com/davivcgarcia/aws-eks-sandbox.git
cd aws-eks-sandbox/
  1. Provision infrastructure with Terraform:
cd tf/
terraform init
terraform apply
  1. Update Kubeconfig using the new cluster parameters:
EKS_CLUSTER_NAME=$(terraform output -raw EKSClusterName)
EKS_CLUSTER_REGION=$(terraform output -raw EKSClusterRegion)
aws eks update-kubeconfig --name $EKS_CLUSTER_NAME --region $EKS_CLUSTER_REGION

Cleanup

  1. Delete all Karpenter resources to remove EC2 Fleet instances:
kubectl delete NodePools,EC2NodeClass --all
  1. Delete all network resources to LB Controller to remove ELBs:
kubectl get services --all-namespaces -o json | jq -r '.items[] | select(.spec.type == "LoadBalancer") | .metadata.name + " " + .metadata.namespace' | while read name namespace; do kubectl delete service $name -n $namespace; done
kubectl get ingress --all-namespaces -o json | jq -r '.items[] | select(.spec.ingressClassName == "alb") | .metadata.namespace + " " + .metadata.name' | while read name namespace; do kubectl delete ingress $name -n $namespace; done
  1. Delete all storage resources to LB Controller to remove EBS/EFS:
kubectl delete pvc --all-namespaces --all
kubectl delete pv --all
  1. Destroy AWS resources created by Terraform:
terraform destroy

About

Terraform infrastructure code for bootstrapping an prod-like Amazon EKS cluster

Topics

Resources

License

Stars

Watchers

Forks

Languages