WOSS
Cloud Native AI in Production: Patterns, Pitfalls & a Reference Architecture
Aman Mundra · 2026-07-04
TL;DR - Cloud Native AI (CNAI) is the discipline of building and running AI with cloud-native principles - containers, Kubernetes, declarative config. This guide gives you a layered reference architecture, three named patterns you can copy (Inference as a microservice, Training as batch CNAI workloads, Model lifecycle as GitOps), the anti-patterns that waste GPU budgets, and a zero-to-CNAI checklist for seed vs Series A teams.
CNAI stands for Cloud Native Artificial Intelligence - the set of approaches and patterns for building and deploying AI applications and workloads using the principles of Cloud Native. This article is the production-grade blueprint for that definition: the layers, the patterns, and the anti-patterns. New to the term? Start with the history of CNAI.
The demo always works. It's production that breaks you.
A model that scored 94% in a notebook becomes a 2am pager alert the moment real traffic, real cost, and real failure modes arrive. The gap between "it works on my machine" and "it serves ten thousand users reliably" is not a modeling problem. It's an infrastructure problem - and the cloud-native world spent a decade solving its twin.
This is the practitioner's map for crossing that gap.
What breaks when you deploy AI the old way?
The classic AI deployment is a single beefy VM, a pip install, and a shell script someone runs by hand. It works - until it doesn't.
- Latency & scale: one process, one machine. Traffic spikes, and requests queue behind each other. There is no horizontal scaling story.
- Cost: an expensive GPU sits idle 80% of the day, then can't keep up at peak. You pay for the peak, always.
- Maintenance: the "environment" lives in one person's head. The machine reboots, a dependency drifts, and nobody can reproduce it.
- No reproducibility: which data, which weights, which code produced this prediction? Unknown.
Cloud-native principles fix each: elasticity (scale replicas with load), portability (containers run identically anywhere), self-healing (crashed pods restart automatically), and declarative config (the whole system is described in version-controlled files). CNAI is simply applying that discipline to every stage of the AI lifecycle.
What does a CNAI reference architecture look like?
Think in layers, each a replaceable box with a clear contract.
flowchart LR
A[Data ingestion] --> B[Feature store]
B --> C[Training jobs\nK8s Jobs on GPU/spot]
C --> D[Model registry]
D --> E[Inference services\nautoscaled microservices]
E --> F[API gateway\nauth · rate limit · routing]
G[Observability\nOTel · Prometheus · Grafana] -.watches.- C
G -.watches.- E
- Data ingestion → feature store: raw events land, get cleaned, and become versioned features shared by training and serving (kills training/serving skew).
- Training jobs: run as Kubernetes
Jobs on GPU or spot nodes - start, consume resources, finish, release them. - Model registry: the source of truth for versioned, promotable model artifacts.
- Inference services: autoscaled microservices behind an API gateway that handles auth, rate limiting, and routing.
- Observability wraps everything.
The non-negotiables across every box: RBAC (least privilege), NetworkPolicy (default-deny between services), autoscaling (HPA for pods, Karpenter/cluster-autoscaler for nodes), right-sized requests/limits, health probes, and secrets pulled from a manager - never baked into images.
Pattern 1 - Inference as a microservice
Treat every model as a stateless service that scales on demand, ships behind a gateway, and rolls out safely with canary or blue-green.
apiVersion: apps/v1
kind: Deployment
metadata: { name: sentiment-inference, labels: { app: sentiment } }
spec:
replicas: 2
selector: { matchLabels: { app: sentiment } }
template:
metadata: { labels: { app: sentiment } }
spec:
securityContext: { runAsNonRoot: true, runAsUser: 1000 }
containers:
- name: server
image: registry.example.com/sentiment:1.4.2
resources:
requests: { cpu: "1", memory: 2Gi, nvidia.com/gpu: 1 }
limits: { cpu: "2", memory: 4Gi, nvidia.com/gpu: 1 }
readinessProbe: { httpGet: { path: /healthz, port: 8080 }, initialDelaySeconds: 10 }
livenessProbe: { httpGet: { path: /healthz, port: 8080 }, periodSeconds: 15 }
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata: { name: sentiment-hpa }
spec:
scaleTargetRef: { apiVersion: apps/v1, kind: Deployment, name: sentiment-inference }
minReplicas: 2
maxReplicas: 20
metrics:
- type: Resource
resource: { name: cpu, target: { type: Utilization, averageUtilization: 65 } }
That's the whole pattern: pinned image, non-root, explicit GPU/CPU requests, probes so Kubernetes knows when you're healthy, and an HPA so you scale with load instead of paying for peak all day.
Pattern 2 - Training as batch CNAI workloads
Training is not a service - it's a batch job with a beginning and an end. Model it as a Kubernetes Job on cheap, interruptible spot capacity, containerized so it's reproducible.
apiVersion: batch/v1
kind: Job
metadata: { name: train-recommender-2026-07-04 }
spec:
backoffLimit: 2
template:
spec:
restartPolicy: OnFailure
nodeSelector: { karpenter.sh/capacity-type: spot }
tolerations:
- key: nvidia.com/gpu
operator: Exists
effect: NoSchedule
containers:
- name: trainer
image: registry.example.com/recommender-train:2026-07-04
resources: { requests: { nvidia.com/gpu: 4 }, limits: { nvidia.com/gpu: 4 } }
envFrom: [{ secretRef: { name: training-creds } }]
The payoff: spot GPUs are a fraction of on-demand price, the Job releases the node the instant it finishes, and backoffLimit handles the spot interruptions gracefully. For a cost-conscious team - especially in India, where GPU budgets are real constraints - this pattern alone can cut training spend by more than half.
Pattern 3 - Model lifecycle as GitOps
Treat models like code: a change to a manifest in Git - not a human running a command - is what promotes a model from staging to production. The registry holds the artifact; Git holds the intent; a CI/CD pipeline reconciles them.
# .github/workflows/promote-model.yml (excerpt)
name: promote-model
on: { push: { paths: ["envs/prod/model-version.yaml"] } }
jobs:
promote:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Validate model card + eval gate
run: ./scripts/check_eval_thresholds.sh envs/prod/model-version.yaml
- name: Sync to cluster (GitOps)
run: kubectl apply -f envs/prod/ # or let Argo CD/Flux reconcile
Now every model promotion is a reviewable pull request with an eval gate, an audit trail, and a one-line rollback (git revert). No more "who deployed which model on Tuesday?"
What are the anti-patterns that quietly kill CNAI teams?
- Over-engineering the platform too early. A seed-stage team does not need a service mesh, three databases, and a custom operator. Chasing shiny tools is how you spend your runway on YAML instead of product. Start with managed Kubernetes and add complexity only when a real problem demands it.
- GPU cost traps. Over-provisioned GPUs with no autoscaling and no resource limits are the single biggest line-item surprise in AI infra. Always set
limits, always autoscale, and push training to spot. - Security as an afterthought. Containers running as root, no NetworkPolicy (so any pod can talk to any pod), and secrets hard-coded in images. Default-deny networking and non-root containers cost you an hour and save you an incident.
What does a real CNAI stack look like - seed vs Series A?
Take an anonymized AI SaaS (say, a GEO/AEO analytics tool or a data-annotation platform). The architecture shape is identical at both stages; the investment differs.
Zero-to-CNAI checklist:
| Capability | Seed stage | Series A |
|---|---|---|
| Cluster | One managed K8s cluster (EKS/GKE), spot for training | Multi-env (dev/stage/prod), node pools per workload |
| Inference | HPA + a gateway | + canary rollouts, autoscaling on custom metrics (QPS, latency) |
| Training | Spot Jobs, manual trigger | Scheduled pipelines, feature store, experiment tracking |
| Model mgmt | Registry + Git tags | Full GitOps promotion with eval gates |
| Observability | Prometheus + Grafana + basic alerts | OTel tracing, per-model dashboards, cost attribution |
| Security | Non-root, NetworkPolicy, secrets manager | + RBAC per team, policy-as-code, image signing |
The lesson: you don't need the Series A stack to start - you need the seed column done right, with a shape that grows into the next. That is what "cloud native" buys you: the same architecture, dialed up.
What does the inference request path actually look like?
A reference architecture is only as good as the path a single request takes through it. Here is that path for Inference as a microservice, from client to GPU and back:
┌────────────┐ auth · rate limit · route
Client ─┤ API gateway ├──────────────┐
└────────────┘ │
▼
┌──────────────────┐
│ Inference Service│ (Deployment + HPA)
│ ┌────┐ ┌────┐ │
│ │pod │ │pod │… │ ← scales on CPU/QPS/latency
│ └─┬──┘ └─┬──┘ │
└────┼───────┼──────┘
▼ ▼
GPU node GPU node (Karpenter-provisioned)
│
spans ──────┼──────► OTel → Prometheus/Grafana
Each hop is a place to enforce a contract: the gateway owns auth and rate limits so the model service never sees an unauthenticated request; the HPA owns elasticity so replicas track load; the node autoscaler owns GPU supply so you never hand-provision hardware; and OpenTelemetry threads a trace through all of it so a slow response is a diagnosable span, not a mystery. This is the same observability discipline the agentic CNAI piece extends to multi-agent systems.
How do you roll out a new model without downtime?
Promotion is where most CNAI teams get burned: they swap a model in place, a regression slips through, and every user feels it at once. The cloud-native answer is a progressive rollout - send a slice of traffic to the new version, watch the eval and error metrics, and only then shift the rest.
# Canary rollout via a rollout controller (excerpt)
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata: { name: sentiment-inference }
spec:
strategy:
canary:
steps:
- setWeight: 10 # 10% of traffic to the new model
- pause: { duration: 10m } # watch eval + error rate
- setWeight: 50
- pause: { duration: 10m }
- setWeight: 100 # full promotion, or auto-rollback on failure
Wire the pauses to your metrics: if error rate or an online eval regresses during a step, the controller rolls back automatically. Combined with Model lifecycle as GitOps, this means every promotion is a reviewable pull request and a metric-gated, self-reverting deploy - the two safety nets that let a small team ship models daily without a war room.
Frequently asked
What is Cloud Native AI (CNAI) in production?
CNAI in production means running the full AI lifecycle - data, training, serving, and monitoring - using cloud-native infrastructure: containers, Kubernetes orchestration, autoscaling, declarative config, and observability. It replaces one-off VMs and manual scripts with reproducible, elastic, self-healing systems.
What is the best architecture for deploying AI models at scale?
A layered reference architecture: data ingestion → feature store → training jobs (on Kubernetes, using spot GPUs) → model registry → autoscaled inference microservices → API gateway, all wrapped in observability, with RBAC, NetworkPolicy, and right-sized resources as defaults.
How do you control GPU costs in Cloud Native AI?
Set resource requests and limits on every workload, autoscale inference with an HPA so you don't pay for peak capacity around the clock, and run training as batch jobs on interruptible spot GPU nodes. These three moves typically cut AI infrastructure spend dramatically.
How do you promote a model to production safely?
Treat promotion as a metric-gated, reviewable event: hold artifacts in a model registry, express the intended version in Git (Model lifecycle as GitOps), gate the pull request on an eval threshold, and roll out progressively with a canary that auto-reverts if error rate or online evals regress. That combination gives you an audit trail, a one-line rollback, and no big-bang swaps.
Written by Aman Mundra - founder of Welzin and the Welzin Open Source Software (WOSS), coining and advancing CNAI (Cloud Native Artificial Intelligence): architectures, patterns, and real-world systems. Part 5 of an ongoing CNAI series - Part 1, Part 2, Part 3, Part 4 - History of CNAI, Part 6 - Agentic CNAI, Part 7 - AI-Ready Kubernetes.