This Terraform configuration deploys an Amazon EKS cluster with Karpenter autoscaling, supporting both x86 and ARM64 (Graviton) instances with Spot and On-Demand pricing.
- AWS CLI configured with appropriate permissions
- Terraform >= 1.13
- kubectl installed
- Helm installed
# Initialize Terraform
terraform init
# Review the deployment plan
terraform plan
# Deploy the infrastructure
terraform apply# Update kubeconfig (replace with your region and cluster name)
aws eks update-kubeconfig --region us-west-2 --name opsfleet-eks
# Verify cluster access
kubectl get nodesTo deploy a workload specifically to x86 (AMD64) nodes:
kubectl apply -f examples/x86-deployment.yamlThis deployment uses nodeSelector to target x86 nodes:
kubernetes.io/arch: amd64karpenter.sh/nodepool: x86-nodepool
To deploy a workload specifically to ARM64 (Graviton) nodes:
kubectl apply -f examples/arm64-deployment.yamlThis deployment uses nodeSelector to target ARM64 nodes:
kubernetes.io/arch: arm64karpenter.sh/nodepool: arm64-nodepool
- EKS Cluster: Latest version (1.28+) in a dedicated VPC
- Karpenter: Node autoscaler with two NodePools (x86 and ARM64)
- Spot & On-Demand: Both instance types supported for cost optimization
- Multi-AZ: High availability across multiple availability zones
Key variables can be customized in terraform.tfvars:
cluster_name: Name of the EKS clusterkubernetes_version: Kubernetes versionaws_region: AWS region for deploymentvpc_cidr: CIDR block for VPC
# Remove workloads first
kubectl delete -f examples/
# Destroy infrastructure
terraform destroyThe examples/ directory contains:
x86-deployment.yaml: Deploy to x86 nodesarm64-deployment.yaml: Deploy to ARM64/Graviton nodesmixed-architecture-deployment.yaml: Allow any architecture
- Latest EKS version
- Karpenter with x86 and ARM64 node pools
- Spot instance support with interruption handling
- Dedicated VPC with proper networking
- Production-ready security configuration