How aws-samples/sample-aws-eks-auto-mode works
Project Type & Purpose
• This is an infrastructure‐as‐code (IaC) repository using Terraform to provision an AWS EKS (Kubernetes) cluster in “Auto Mode” with multiple node pool types.
• It includes example Kubernetes manifests for Graviton, Spot, GPU, and Inferentia2 workloads.
File Structure
• Top‐level terraform/ folder: contains .tf files for VPC, EKS cluster, outputs, variables, versions.
• nodepool-templates/: Karpenter Provisioner templates for ARM (Graviton), Spot, GPU, Neuron node pools.
• examples/: sample Kubernetes YAMLs under subdirectories for GPU, Graviton, Neuron, Spot workloads.
• README.md: describes architecture, prerequisites, examples, security.
Main Components
a. Terraform Control Plane
• Terraform CLI (init, apply)
• Terraform modules (.tf files)
b. AWS Cloud Resources
• VPC with public/private subnets (automatically tagged)
• EKS Cluster (Auto Mode)
• Karpenter Provisioner (the Auto Mode engine)
• NodePools: Graviton (ARM64), Spot, GPU, Neuron
• Load Balancers: ALB (IngressClass), NLB (Service)
c. Kubernetes Control Plane & Resources
• API Server (kubectl configured via terraform output)
• Kubernetes namespaces (examples/gpu, /graviton, /neuron, /spot)
• Deployments/Services for sample workloads (2048 game, DeepSeek, Whisper)
• Ingress and Service YAMLs for ALB/NLB
d. External Services
• AWS IAM roles
• Third‐party ML models invoked by GPU/Neuron workloads
Relationships & Data Flows
• Terraform → AWS APIs: provisions VPC, EKS, subnets, IAM, tags.
• EKS Control Plane ↔ Karpenter Provisioner (CRDs) → automatically launches EC2 nodes in specified node pools.
• Kubernetes API → schedules Pods onto nodes (Graviton/Spot/GPU/Neuron).
• ALB Ingress → routes external traffic to Kubernetes Services → Pods.
• NLB Service → external network load balancer for high‐throughput services.
• kubectl ↔ API Server for deploying example YAMLs.
Architectural Patterns & Design Principles
• Infrastructure as Code: all AWS infra defined in Terraform.
• Cloud Native Auto Scaling: Karpenter dynamically provisions nodes based on workload.
• Separation of Concerns:
– nodepool-templates define compute parameters
– examples define application workloads
– terraform folder wires everything together
• Built‐in High Availability: multiple subnets, managed EKS control plane.
• Cost optimization: mixed instance types (Graviton, Spot, GPU, Inferentia2).
Essential Elements Checklist
• [ ] Clear labels for each Terraform module and AWS resource
• IaC/Control (Terraform)
• AWS Infrastructure
• Kubernetes Control Plane
• Worker Nodes & Workloads
• [ ] Annotations for key services (e.g., “Karpenter Auto-Scaling”)