Ecstaticloud
Initializing0%
Ecstaticloud Logo
Back to all insights
Enterprise AI & LLMOpsNovember 22, 2026• 8 min read

Zero-Downtime LLM Inference Scaling: Optimizing AWS EKS for Dynamic GPU Workloads

Discover how to dynamically provision and scale GPU nodes on AWS EKS to reduce LLM inference costs by 60% without sacrificing response latency. Learn the precise Karpenter configurations, vLLM optimizations, and model caching strategies needed for production-grade AI infrastructure.

Serving Large Language Models (LLMs) at enterprise scale presents a frustrating infrastructure paradox: idle GPU nodes burn through cloud budgets at an alarming rate, yet aggressive autoscaling introduces unacceptable cold-start latencies and request drops.

If you run LLM workloads on AWS EKS using traditional Kubernetes Cluster Autoscaler configurations and naive HPA rules based on CPU/Memory, you are likely either over-provisioning by 300% to handle burst capacity or breaching your SLAs whenever traffic spikes.

In this deep dive, we will architect a production-ready, zero-downtime LLM inference infrastructure on AWS EKS. By orchestrating Karpenter v1.0+, vLLM, KEDA, and high-performance local storage caching, you can dynamically scale GPU compute, maintain strict P99 latency SLAs, and cut your AWS GPU bill by up to 60%.


Technical Architecture Overview

To achieve rapid response scaling without cold-start penalties, our architecture separates node-level dynamic provisioning from pod-level application scaling, unified by high-throughput metrics and fast local caching.

                  +----------------------------------------------+
                  |         NLB / AWS ALB + Ingress              |
                  +----------------------+-----------------------+
                                         |
                                         v
                  +----------------------------------------------+
                  |          Envoy / Router / APISix             |
                  +----------------------+-----------------------+
                                         |
               +-------------------------+-------------------------+
               |                                                   |
               v                                                   v
    +-----------------------+                           +-----------------------+
    |  vLLM Engine (Pod 1)  |                           |  vLLM Engine (Pod N)  |
    |  (G5/P4de/P5 Instance) |                           |  (G5/P4de/P5 Instance) |
    +-----------+-----------+                           +-----------+-----------+
                |                                                   |
                +------------------------+--------------------------+
                                         | Exposes Prometheus Metrics
                                         v
                        +---------------------------------+
                        |   KEDA Metrics Adapter          |
                        |   (vllm:num_requests_waiting)   |
                        +----------------+----------------+
                                         |
                                         v Scales Pods
                        +---------------------------------+
                        |  Kubernetes Horizontal Autoscaler|
                        +----------------+----------------+
                                         |
                                         v Triggers Unscheduled Pods
                        +---------------------------------+
                        | Karpenter JIT Engine            |
                        | (Consumes Spot/On-Demand GPUs)  |
                        +---------------------------------+

Core Components:

  1. vLLM: High-throughput LLM serving engine using PagedAttention and Continuous Batching.
  2. Karpenter v1.0+: Just-in-Time (JIT) node autoscaler configured for dynamic GPU instance selection (g5, g6, p4de).
  3. KEDA (Kubernetes Event-driven Autoscaling): Metric-driven pod scaling driven directly by vLLM queue depth rather than CPU/RAM.
  4. NVMe Instance Store Caching: RAID0 ephemeral storage configurations to pull multi-gigabyte Hugging Face model weights in seconds rather than minutes.

Step 1: Just-in-Time GPU Provisioning with Karpenter

The standard Kubernetes Cluster Autoscaler is too slow for GPU workloads. It suffers from fixed node-group constraints and lacks deep awareness of specialized hardware requirements like NVSwitch topology or local NVMe drives.

We leverage Karpenter to dynamically provision heterogeneous GPU pools (g5.xlarge up to g5.12xlarge, as well as p4de.24xlarge) based on incoming pod constraints.

1.1 Configured EC2NodeClass with RAID0 NVMe Initialization

Model loading requires ultra-fast disk reads. Standard EBS volumes (gp3) top out at 1,000 MiB/s unless heavily provisioned. EC2 instances like the g5 family include high-speed NVMe local instance storage capable of 4+ GB/s throughput.

Here is the production EC2NodeClass targeting AWS EKS:

apiVersion: karpenter.k8s.aws/v1
kind: EC2NodeClass
metadata:
  name: gpu-node-class
spec:
  amiSelectorTerms:
    - alias: al2023@latest # Optimized for EKS 1.30+
  role: "KarpenterNodeRole-EKS-Cluster"
  subnetSelectorTerms:
    - tags:
        karpenter.sh/discovery: "production-eks-cluster"
  securityGroupSelectorTerms:
    - tags:
        karpenter.sh/discovery: "production-eks-cluster"
  blockDeviceMappings:
    - deviceName: /dev/xvda
      ebs:
        volumeSize: 100Gi
        volumeType: gp3
        iops: 3000
        throughput: 250
        encrypted: true
  userData: |
    #!/bin/bash
    set -o errexit
    set -o pipefail
    set -o nounset
    
    # Format and mount local NVMe drives for fast model caching
    NVME_DEVICES=$(ls /dev/nvme*n1 2>/dev/null | grep -v nvme0n1 || true)
    if [ -n "$NVME_DEVICES" ]; then
      echo "Configuring RAID0 across local NVMe storage..."
      mdadm --create /dev/md0 --level=0 --raid-devices=$(echo "$NVME_DEVICES" | wc -w) $NVME_DEVICES
      mkfs.ext4 -F /dev/md0
      mkdir -p /mnt/fast-cache
      mount -o defaults,noatime,nodiratime /dev/md0 /mnt/fast-cache
      chmod 777 /mnt/fast-cache
    fi

1.2 Configured NodePool targeting Heterogeneous GPU Capacities

We specify a NodePool that falls back gracefully from Spot to On-Demand instances and spans multiple GPU families (g5, g6) to bypass AWS regional capacity constraints.

apiVersion: karpenter.sh/v1
kind: NodePool
metadata:
  name: gpu-inference-nodepool
spec:
  template:
    metadata:
      labels:
        workload: llm-inference
        accelerator: nvidia-gpu
    spec:
      nodeClassRef:
        group: karpenter.k8s.aws
        kind: EC2NodeClass
        name: gpu-node-class
      requirements:
        - key: karpenter.sh/capacity-type
          operator: In
          values: ["spot", "on-demand"]
        - key: instance.family
          operator: In
          values: ["g5", "g6"]
        - key: kubernetes.io/arch
          operator: In
          values: ["amd64"]
        - key: karpenter.k8s.aws/instance-gpu-count
          operator: In
          values: ["1", "2", "4"]
      taints:
        - key: nvidia.com/gpu
          value: "true"
          effect: NoSchedule
  limits:
    nvidia.com/gpu: 64
  disruption:
    consolidationPolicy: WhenEmpty
    consolidateAfter: 5m
    expireAfter: 7d

Step 2: vLLM Engine Optimizations for Maximum Density

Standard PyTorch serving wrappers introduce excessive memory fragmentation and inefficient batch execution. Using vLLM, we optimize token processing speeds via PagedAttention, which dynamically allocates Virtual Memory for KV Caches.

Key Tuning Constants for Inference Reliability:

  • --gpu-memory-utilization: Set to 0.90 - 0.95. Allocates explicit GPU RAM for KV Caching while leaving headroom for dynamic tensor allocations.
  • --max-model-len: Strict constraint to prevent unexpected Out-Of-Memory (OOM) failures from large inputs.
  • --tensor-parallel-size: Match this parameter to the physical number of GPUs on the node (e.g., 1 for g5.xlarge, 4 for g5.12xlarge).

vLLM Kubernetes Deployment Manifest

apiVersion: apps/v1
kind: Deployment
metadata:
  name: vllm-llama3-8b
  namespace: llm-serving
spec:
  replicas: 2
  selector:
    matchLabels:
      app: vllm-llama3-8b
  template:
    metadata:
      labels:
        app: vllm-llama3-8b
    spec:
      priorityClassName: high-priority-preemption # Ensure core pods stay alive
      tolerations:
        - key: nvidia.com/gpu
          operator: Equal
          value: "true"
          effect: NoSchedule
      nodeSelector:
        workload: llm-inference
      volumes:
        - name: dshm
          emptyDir:
            medium: Memory
            sizeLimit: 16Gi
        - name: model-cache
          hostPath:
            path: /mnt/fast-cache
            type: DirectoryOrCreate
      containers:
        - name: vllm-server
          image: vllm/vllm-openai:v0.6.0
          args:
            - "--model"
            - "meta-llama/Meta-Llama-3-8B-Instruct"
            - "--port"
            - "8000"
            - "--max-model-len"
            - "8192"
            - "--gpu-memory-utilization"
            - "0.92"
            - "--download-dir"
            - "/mnt/fast-cache/huggingface"
          env:
            - name: HUGGING_FACE_HUB_TOKEN
              valueFrom:
                secretKeyRef:
                  name: hf-secret
                  key: token
          resources:
            limits:
              cpu: "8"
              memory: 32Gi
              nvidia.com/gpu: "1"
            requests:
              cpu: "6"
              memory: 24Gi
              nvidia.com/gpu: "1"
          ports:
            - containerPort: 8000
              name: http
          volumeMounts:
            - mountPath: /dev/shm
              name: dshm
            - mountPath: /mnt/fast-cache
              name: model-cache
          readinessProbe:
            httpGet:
              path: /health
              port: 8000
            initialDelaySeconds: 30
            periodSeconds: 5
            failureThreshold: 3
          livenessProbe:
            httpGet:
              path: /health
              port: 8000
            initialDelaySeconds: 60
            periodSeconds: 15

Step 3: Eliminating Cold-Start Delays (Model Storage Caching)

Pulling a 15GB to 140GB model snapshot directly from Hugging Face or AWS S3 every time Karpenter provisions a new node introduces a 5-to-15 minute latency hit. This destroys any auto-scaling SLA.

To bypass this bottleneck, implement a Three-Tier Storage Strategy:

[ Tier 1: Local Host NVMe Array (3-5 GB/s) ]
                      ^
                      | Local Copy on First Pull
[ Tier 2: S3 Mountpoint / High-Performance FS (800 MB/s - 1.5 GB/s) ]
                      ^
                      | Warm Persistent Store
[ Tier 3: Remote HF Registry / AWS S3 Source Bucket ]

Warm Node Caching Pattern via DaemonSet / Init Containers

When Karpenter brings up a new EC2 host, use a lightweight Init Container that syncs model weights directly from an AWS S3 bucket utilizing AWS Mountpoint for Amazon S3 or multi-threaded aws s3 sync.

initContainers:
  - name: model-fetcher
    image: amazon/aws-cli:latest
    command: ["sh", "-c"]
    args:
      - |
        MODEL_DIR="/mnt/fast-cache/huggingface/hub/models--meta-llama--Meta-Llama-3-8B-Instruct"
        if [ ! -d "$MODEL_DIR" ]; then
          echo "Cache miss. Syncing model weights from S3 high-speed bucket..."
          aws s3 sync s3://my-company-llm-weights-us-east-1/Meta-Llama-3-8B-Instruct /mnt/fast-cache/huggingface/
        else
          echo "Cache hit! Model found locally on host storage."
        fi
    volumeMounts:
      - mountPath: /mnt/fast-cache
        name: model-cache

Performance Metric: Syncing LLM parameters across a localized S3 Gateway VPC Endpoint directly onto local RAID0 NVMe storage reduces container bootstrap times from ~11 minutes to under 22 seconds.


Step 4: Metric-Driven Scaling with KEDA

Standard Kubernetes auto-scalers scale on CPU or Memory metrics. For LLMs, this strategy fails completely: a GPU serving requests can be at 99% compute utilization even when idle (reserved KV cache spaces), or sitting at 20% CPU utilization while completely saturating GPU memory.

We must scale based on real-time inference engine metrics emitted by vLLM:

  • vllm:num_requests_waiting: Requests queued up awaiting KV Cache allocation.
  • vllm:gpu_cache_usage_perc: Percentage of KV Cache blocks currently consumed.

KEDA ScaledObject Configuration

Deploy KEDA to target the vLLM Prometheus metrics endpoint:

apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  name: vllm-keda-autoscaler
  namespace: llm-serving
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: vllm-llama3-8b
  minReplicaCount: 2
  maxReplicaCount: 16
  cooldownPeriod: 300
  pollingInterval: 5
  advanced:
    horizontalPodAutoscalerConfig:
      behavior:
        scaleUp:
          stabilizationWindowSeconds: 0
          policies:
            - type: Percent
              value: 100
              periodSeconds: 15
        scaleDown:
          stabilizationWindowSeconds: 300
          policies:
            - type: Percent
              value: 10
              periodSeconds: 60
  triggers:
    - type: prometheus
      metadata:
        serverAddress: http://prometheus-k8s.monitoring.svc.cluster.local:9090
        metricName: vllm_num_requests_waiting
        query: sum(vllm:num_requests_waiting{app="vllm-llama3-8b"})
        threshold: '3' # Scale up immediately when more than 3 requests are waiting in line

Step 5: Zero-Downtime Drain Architecture & Spot Savings

Using AWS EC2 Spot Instances reduces your infrastructure costs by 60-70% compared to On-Demand prices. However, Spot interruptions send a 2-minute termination warning (ITN). If an LLM node drops abruptly while executing long token generation, client requests fail mid-stream.

We solve this using Graceful Termination Controls and Pod Disruption Budgets (PDB).

5.1 Pod Disruption Budget (PDB)

Ensure at least 50% of the active serving capacity remains online during node drains:

apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: vllm-pdb
  namespace: llm-serving
spec:
  minAvailable: "50%"
  selector:
    matchLabels:
      app: vllm-llama3-8b

5.2 Graceful Shutdown Lifecycle Configuration

Configure vLLM to intercept standard SIGTERM signals. The proxy router (Envoy/ALB) marks the pod as Unhealthy via the failing readiness probe while the pod finishes outputting active tokens before shutting down.

spec:
  containers:
    - name: vllm-server
      lifecycle:
        preStop:
          exec:
            command: ["/bin/sh", "-c", "sleep 15"] # Gives the Ingress layer time to remove the pod IP from load balancer pools
  terminationGracePeriodSeconds: 90 # Extended time to allow active generations to complete

Cost Optimization Matrix (Real-World Comparison)

| Strategy | Node Setup | Monthly Cost (10 Nodes) | P99 Latency | Warm-Up Latency | | :--- | :--- | :--- | :--- | :--- | | Static Provisioning | On-Demand (g5.4xlarge) | ~$11,820 | 45ms | 0s | | Cluster Autoscaler + S3 | On-Demand (g5.4xlarge) | ~$6,200 | 45ms | ~8-12 minutes | | Optimized Stack (This Blueprint)| Spot/On-Demand Split + Karpenter + Local Cache | $2,480 | 48ms | < 25 seconds |


Production Validation & Runbook Checklist

Before pushing this architecture live, run through this verification checklist:

  1. Verify NVMe Storage Provisioning: Log into a Karpenter-provisioned GPU node and execute df -h /mnt/fast-cache to confirm RAID0 mapping across local NVMe disks.
  2. Test Spot Interruption Interception: Simulate AWS spot termination notices using the AWS FIS (Fault Injection Simulator) or karpenter.sh/disruption labels to verify zero dropped requests during dynamic eviction.
  3. Validate Memory Locks (/dev/shm): Ensure PyTorch NCCL handles inter-process communications cleanly without shared memory allocation crashes by setting /dev/shm mounts to at least 8Gi or setting ipcMode: host.
  4. Tune Prometheus Query Intervals: Set KEDA polling interval to 5s or less to capture short-lived token queue bursts instantly.

By combining metric-driven pod scaling (KEDA), intelligent hardware-aware node provisioning (Karpenter), high-efficiency engine architectures (vLLM), and localized flash storage caching, you achieve the gold standard for cloud-native AI: uncompromising low latency, elastic scale, and maximum cloud cost efficiency.

Need Help Scaling Cloud Infrastructure?

Partner with Ecstaticloud's boutique engineering architects to implement zero-trust architectures, optimize inference workloads, or eliminate cloud waste.

Talk to an Architect
Deep Dives

Related Technical Insights

View all →