This Terraform project creates an EKS cluster with the following components:
- VPC with public and private subnets
- EKS cluster with a single worker node
- AWS EBS CSI Driver for storage
- Nginx deployment with 1 pod
- 20GB EBS volume mounted to the Nginx pod at
/data
- AWS CLI configured with appropriate credentials
- Terraform >= 1.0
- kubectl
- helm
- Initialize Terraform:
terraform init- Review the planned changes:
terraform plan- Apply the configuration:
terraform apply- Configure kubectl to use the new cluster:
aws eks update-kubeconfig --region $(terraform output -raw region) --name $(terraform output -raw cluster_name)- Verify the deployment:
kubectl get pods
kubectl get pvc
kubectl get scTo destroy all resources:
terraform destroyThe following variables can be customized in variables.tf or through a tfvars file:
region: AWS region (default: us-west-2)cluster_name: Name of the EKS cluster (default: demo-eks-cluster)vpc_cidr: CIDR block for VPC (default: 10.0.0.0/16)environment: Environment name (default: demo)
git config --local user.name zoonderkins
git config --local user.email [email protected]