A production-ready Terraform configuration for AWS EKS with static node groups, proper networking, and essential add-ons.
-
VPC Configuration:
- Public and private subnets across multiple AZs
- NAT gateways for private subnet internet access
- Proper security groups and network ACLs
-
EKS Cluster:
- Static node groups (no auto-scaling to prevent unexpected behavior)
- Separate node groups for different workload types (core, compute, GPU)
- Proper IAM role configuration
-
Add-ons:
- AWS Load Balancer Controller (for ALB/NLB integration)
- Metrics Server (for basic monitoring)
- AWS FSx CSI Driver (for storage)
- NVIDIA GPU support (for ML/AI workloads)
- AWS CLI configured with appropriate access
- Terraform v1.0.0+ installed
- kubectl installed
- Access to create VPC, EKS, IAM, and related resources in AWS
-
Clone this repository
git clone https://github.com/yourusername/universal-eks-terraform-base.git cd universal-eks-terraform-base -
Initialize Terraform
terraform init
-
Customize your deployment by creating a
terraform.tfvarsfilecp terraform.tfvars.example terraform.tfvars # Edit terraform.tfvars with your desired settings -
Deploy the infrastructure
terraform apply
-
Configure kubectl to connect to your new cluster
aws eks update-kubeconfig --name <cluster-name> --region <region>
This base configuration provides the infrastructure layer. To deploy applications on top:
-
Get the cluster name and endpoint from Terraform outputs:
terraform output cluster_name terraform output cluster_endpoint
-
Use Helm to deploy additional components:
# Add a Helm repository helm repo add bitnami https://charts.bitnami.com/bitnami # Install a chart helm install my-release bitnami/nginx
Modify variables.tf or create a custom terraform.tfvars file to adjust:
- Region and availability zones
- VPC CIDR ranges
- Node group sizes and instance types
- Cluster version
- Additional add-ons