Leandro Mantovani

Leandro Mantovani

Slashing AI Cloud Bills by 70% with Kubernetes MIG and KEDA

Slashing AI Cloud Bills by 70% with Kubernetes MIG and KEDA

Generative AI is a startup superpower, but idle GPU instances are silent runway killers. Learn how to stop wasting compute resources and slash your AI cloud bills by 70% using Kubernetes MIG, NVIDIA Time-Slicing, and fractional SREs.

You just shipped a game-changing, LLM-powered feature, and user adoption is off the charts. Then, the AWS bill arrives. Your cloud costs have exploded, yet a quick glance at your observability dashboards reveals a sickening truth: your $3,000-a-month A100 instances are sitting at a dismal 15% utilization. This is the GPU wasting epidemic. While shipping AI pipelines accelerates valuation, relying on legacy 1:1 GPU provisioning is silently bleeding your financial runway dry. Here is how top engineering teams are stopping the cash bleed.

The race to integrate Generative AI is creating a quiet but fatal crisis inside scaling startups. While shipping an LLM-powered feature or a new computer vision pipeline can drastically accelerate user acquisition, the underlying infrastructure costs are often disproportionate to the revenue those features generate. We are seeing a widespread epidemic where the average startup engineering team is wasting up to 80% of their exorbitant GPU cloud spend on idle compute. 

Why? Because traditional cloud provisioning architectures were not built for the bursty, high-latency nature of AI inference. 

In this post, we’ll explore the economics of AI compute, how the legacy provisioning models lead to massive wasted capacity, and the exact technical blueprints we use at Betta—leveraging Kubernetes Multi-Instance GPUs (MIG), NVIDIA Time-Slicing, and KEDA—to cut GPU cloud costs by up to 70%.

The Economics of AI Compute: The 1:1 Provisioning Trap

Historically, if a microservice needed to execute a background job, you'd deploy it to a standard Kubernetes node pool, rely on CPU limits, and let the Kubernetes scheduler pack as many pods as possible onto your EC2 instances. 

But when engineering teams pivot to AI, they often default to a legacy paradigm: 1:1 GPU Provisioning

In standard Kubernetes environments, GPUs are treated as non-divisible, whole integer resources. A container requests nvidia.com/gpu: 1. Even if that microservice only needs to run a lightweight BERT model that requires 2GB of VRAM and a fraction of the compute power, it monopolizes the entire GPU. If you are running an a2-highgpu-1g on GCP (which features a 40GB A100 GPU), your pod is wasting 38GB of VRAM and nearly all of the Streaming Multiprocessors (SMs). 

When you scale this across multiple environments (Dev, Staging, Prod) and multiple AI features, you end up provisioning dozens of dedicated GPU instances. The math becomes brutal:

*   Instance Cost: ~$2,500 - $3,000/month per A100 instance.

*   Microservices: 5 different AI microservices across 3 environments = 15 GPUs.

*   Monthly Burn: ~$45,000/month.

*   Actual Hardware Utilization: < 20%.

This is wasted capacity, and in a macroeconomic environment where capital is expensive, it is a runway killer. To survive, CTOs must move away from whole-GPU allocation and implement infrastructure that slices the hardware intelligently.


Technical Deep Dive: Breaking the 1:1 Problem 

To stop the cash bleed, we need to share physical GPUs across multiple containerized workloads safely and efficiently. Depending on your GPU architecture (Ampere, Hopper, or older generations like Turing/Volta), there are two primary ways Betta implements this in production Kubernetes clusters.


1. Hardware-Level Isolation: Multi-Instance GPU (MIG)

For modern NVIDIA architectures (A100, H100), the gold standard is Multi-Instance GPU (MIG). MIG allows you to partition a single physical GPU into up to seven distinct, fully isolated GPU instances at the hardware level.

Unlike older sharing methods, MIG physically partitions both the compute (Streaming Multiprocessors) and the memory (VRAM). This means a memory leak or a compute-heavy spike in Pod A will have absolutely zero impact on the inference latency of Pod B. 

How it works in Kubernetes:

To implement MIG, we reconfigure the NVIDIA Device Plugin and the GPU Operator. Instead of exposing nvidia.com/gpu: 1, the node exposes specific MIG profiles. 

For a 40GB A100, we might partition it into three instances: two 1g.5gb (1/7th compute, 5GB VRAM) instances for lightweight classification models, and one 3g.20gb instance for a heavier Generative AI workload.

In your Kubernetes Deployment, your resource requests evolve from the generic integer to the specific MIG profile:


resources:
  limits:
    nvidia.com/mig-1g.5gb: 1 # Requests a tightly bound 5GB partition
resources:
  limits:
    nvidia.com/mig-1g.5gb: 1 # Requests a tightly bound 5GB partition
resources:
  limits:
    nvidia.com/mig-1g.5gb: 1 # Requests a tightly bound 5GB partition
resources:
  limits:
    nvidia.com/mig-1g.5gb: 1 # Requests a tightly bound 5GB partition


The Result: You just packed three entirely different microservices onto a single $3,000/month instance with zero noisy-neighbor degradation, instantly cutting your hardware requirement for those services by 66%.


2. Software-Level Sharing: NVIDIA Time-Slicing & MPS

MIG is powerful, but it’s not always applicable. If you are using more cost-effective GPUs (like the T4, V100, or A10g) which don't support MIG, or if you have highly bursty, concurrent workloads that can tolerate minor latency jitter, NVIDIA Time-Slicing is the optimal path.

Time-slicing leverages context switching. It allows multiple pods to share the same GPU compute cores and memory space. The GPU rapidly switches context between workloads. While it doesn't provide the fault isolation of MIG (an Out-Of-Memory error in one pod could theoretically impact the shared VRAM), it is highly effective for internal tooling, asynchronous batch processing, or non-mission-critical endpoints.

Implementing Time-Slicing:

We configure the NVIDIA GPU Operator by passing a custom ConfigMap that defines how many "replicas" of a GPU the node should advertise.


apiVersion: v1
kind: ConfigMap
metadata:
  name: time-slicing-config
data:
  any: |-
    version: v1
    sharing:
      timeSlicing:
        resources:
        - name: nvidia.com/gpu
          replicas: 4 # One physical GPU now acts as 4 usable resources
apiVersion: v1
kind: ConfigMap
metadata:
  name: time-slicing-config
data:
  any: |-
    version: v1
    sharing:
      timeSlicing:
        resources:
        - name: nvidia.com/gpu
          replicas: 4 # One physical GPU now acts as 4 usable resources
apiVersion: v1
kind: ConfigMap
metadata:
  name: time-slicing-config
data:
  any: |-
    version: v1
    sharing:
      timeSlicing:
        resources:
        - name: nvidia.com/gpu
          replicas: 4 # One physical GPU now acts as 4 usable resources
apiVersion: v1
kind: ConfigMap
metadata:
  name: time-slicing-config
data:
  any: |-
    version: v1
    sharing:
      timeSlicing:
        resources:
        - name: nvidia.com/gpu
          replicas: 4 # One physical GPU now acts as 4 usable resources


Suddenly, Kubernetes sees one T4 GPU as four available slots, allowing the scheduler to pack four distinct microservices onto a significantly cheaper EC2 g4dn.xlarge instance. 

For architectures requiring higher concurrency without the latency penalty of context switching, we engineers often integrate NVIDIA MPS (Multi-Process Service). MPS allows multiple CUDA processes to run concurrently on the same GPU by sharing a single CUDA context, further maximizing utilization for lightweight inference endpoints.


Intelligent Autoscaling: Deploying Scale-to-Zero Architectures

Slicing the GPU is only half the battle. The other part is ensuring you aren't running AI inference pods 24/7 if they aren't actively processing requests.

Traditional Horizontal Pod Autoscaler (HPA) metrics (like CPU or Memory utilization) are terrible triggers for AI workloads. AI inference queues can build up rapidly before CPU metrics reflect the bottleneck, leading to timeouts and degraded user experiences. 

To solve this, we use KEDA (Kubernetes Event-driven Autoscaling). KEDA bypasses standard resource metrics and scales pods based on the actual event queue depth (e.g., Kafka, RabbitMQ, SQS) or HTTP request rates.

More importantly, KEDA enables Scale-to-Zero.

If your batch ML job or asynchronous image processing microservice has an empty queue at 3:00 AM, KEDA scales the deployment down to exactly 0 pods. 

A typical KEDA ScaledObject for an SQS-driven AI workload looks like this:


apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  name: ml-inference-scaler
spec:
  scaleTargetRef:
    name: computer-vision-worker
  minReplicaCount: 0  # <--- The magic FinOps number
  maxReplicaCount: 10
  triggers:
  - type: aws-sqs-queue
    metadata:
      queueURL: https://sqs.us-east-1.amazonaws.com/123456789/ai-job-queue
      queueLength: "5" # Scale up for every 5 messages waiting
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  name: ml-inference-scaler
spec:
  scaleTargetRef:
    name: computer-vision-worker
  minReplicaCount: 0  # <--- The magic FinOps number
  maxReplicaCount: 10
  triggers:
  - type: aws-sqs-queue
    metadata:
      queueURL: https://sqs.us-east-1.amazonaws.com/123456789/ai-job-queue
      queueLength: "5" # Scale up for every 5 messages waiting
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  name: ml-inference-scaler
spec:
  scaleTargetRef:
    name: computer-vision-worker
  minReplicaCount: 0  # <--- The magic FinOps number
  maxReplicaCount: 10
  triggers:
  - type: aws-sqs-queue
    metadata:
      queueURL: https://sqs.us-east-1.amazonaws.com/123456789/ai-job-queue
      queueLength: "5" # Scale up for every 5 messages waiting
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  name: ml-inference-scaler
spec:
  scaleTargetRef:
    name: computer-vision-worker
  minReplicaCount: 0  # <--- The magic FinOps number
  maxReplicaCount: 10
  triggers:
  - type: aws-sqs-queue
    metadata:
      queueURL: https://sqs.us-east-1.amazonaws.com/123456789/ai-job-queue
      queueLength: "5" # Scale up for every 5 messages waiting


Orchestrating Node Spindown with Karpenter

Scaling pods to zero isn't enough if the underlying bare-metal or EC2 instance is still running. When KEDA removes the pods, you need an intelligent cluster autoscaler to terminate the expensive hardware. We pairs KEDA with Karpenter, AWS's high-performance Kubernetes cluster autoscaler. The moment Karpenter detects that no pods are requesting nvidia.com/gpu (or a specific MIG profile), it issues a termination signal to the GPU node, removing it from your cloud bill instantly.


Mitigating the Cold Start Penalty

The primary objection to scale-to-zero in AI is the cold start. Pulling a 10GB model weights file from an S3 bucket or a container registry can take minutes, resulting in unacceptable latency for the first request. 

To mitigate this, we add a caching layers using tools like Fluid or JuiceFS combined with node-level NVMe SSD caching. By keeping model weights cached locally on the node pool, a pod scaling from zero can map the weights into memory in seconds rather than minutes, giving you the financial benefits of scale-to-zero without the UX penalty.


The Execution Strategy: Why Startups Are Pivoting to Fractional SREs

Understanding the architecture—MIG, Time-Slicing, Karpenter, KEDA, and Local NVMe caching—is one thing. Implementing it into a fragile, live production environment without causing downtime is a massive engineering challenge. 

For most startups, the traditional playbook looks like this:

1. Realize the AWS/GCP bill is out of control.

2. Open a requisition for a Senior AI Infrastructure / MLOps Engineer.

3. Spend 4 to 6 months trying to hire a specialist who demands a $250k+ base salary, plus significant equity.

4. Continue burning an extra $30k - $50k a month on wasted GPU spend while the recruiter searches.

The math simply doesn’t work for scaling startups. 

This is exactly where the 80/20 rule shifts in favor of fractional specialized talent. Your core engineering team's mandate should be building proprietary AI models and shipping user-facing features—not wrangling CUDA drivers, Helm charts, and Kubernetes device plugins.

At Betta, our fractional DevOps and SRE experts step in to break this bottleneck. Because our engineers have implemented these exact GPU FinOps architectures dozens of times, we bypass the learning curve entirely. 

Betta Fractional SRE Playbook:

Week 1: Audit & Observability. We deploy OpenTelemetry and Prometheus stack extensions to monitor exact GPU utilization (SM, VRAM, PCIe bandwidth) per pod.

Week 2: Node Strategy & Slicing. We re-architect your Kubernetes node pools, configuring MIG for your A100s/H100s and Time-Slicing for your T4s/A10s.

Week 3: Event-Driven Autoscaling. We integrate KEDA to tie your AI inference pods directly to queue depth, enabling aggressive scale-to-zero for asynchronous workloads.

Week 4: FinOps Handoff. We implement Karpenter for hyper-fast node provisioning, document the new internal platform, and hand it back to your team.

Instead of a six-month hiring delay that costs you hundreds of thousands of dollars in cloud waste, a fractional engagement surgically eliminates the problem in weeks. You gain enterprise-grade AI infrastructure, slash your GPU cloud bill by up to 70%, and extend your startup’s vital runway—without inflating your permanent headcount.

The startups that win won't just be the ones with the best Generative AI features; they will be the ones who figure out how to run those features profitably. Stop letting idle GPUs dictate your burn rate. Leverage the technology that's available, and bring in the specialized fractional firepower to get it done today.

Expertos en Infraestructura en la Nube

Expertos en la nube de AWS que entregan soluciones de infraestructura escalables, seguras y

eficientes en costos para equipos en crecimiento.

Hablemos

Asesoría experta en soluciones cloud seguras y escalables.

Expertos en Infraestructura en la Nube

Expertos en la nube de AWS que entregan soluciones de infraestructura escalables, seguras y

eficientes en costos para equipos en crecimiento.

Hablemos

Asesoría experta en soluciones cloud seguras y escalables.

Expertos en Infraestructura en la Nube

Expertos en la nube de AWS que entregan soluciones de infraestructura escalables, seguras y

eficientes en costos para equipos en crecimiento.

Hablemos

Asesoría experta en soluciones cloud seguras y escalables.