30 Days of AIDay 19 of 30 · Week 3: Infrastructure & Hosting
Course outline▾

Week 4 · Enterprise Workflows

  1. Day 22Autonomous Agents: From Passive LLMs to Goal-Driven ExecutionComing soon · 2026-10-22 · 7 PM IST
  2. Day 23Tool Use & Function Calling: Connecting LLMs to APIs, Databases, and ShellsComing soon · 2026-10-23 · 7 PM IST
  3. Day 24Multi-Agent Orchestration: Supervisor, Worker, and Evaluator PatternsComing soon · 2026-10-24 · 7 PM IST
  4. Day 25Automated CI/CD: Automating the Software Lifecycle for AI ModelsComing soon · 2026-10-25 · 7 PM IST
  5. Day 26Zero-Trust Security for AI: Sandboxing Ephemeral Execution & Model EgressComing soon · 2026-10-26 · 7 PM IST
  6. Day 27Observability & Tracing for Agentic Systems (Telemetry, Logs, and Metrics)Coming soon · 2026-10-27 · 7 PM IST
  7. Day 28Human-in-the-Loop Architecture: Machine Second, Human First in PracticeComing soon · 2026-10-28 · 7 PM IST
  8. Day 29Managing Technical Debt, Drift, and Model Governance in Enterprise ITComing soon · 2026-10-29 · 7 PM IST
  9. Day 30The 10-Year Horizon: Architecting IT Strategy for the AI-Native EnterpriseComing soon · 2026-10-30 · 7 PM IST
Open the course page →

Day 19: Kubernetes for AI 101 — Pods, Deployments and Services for Model Serving

2026-10-19 · 8 min read

Watch the video lesson, or subscribe on YouTube for a new lesson every day.

Docker Compose coordinates services on one machine. Enterprise AI needs more: traffic surges, nodes fail, and upgrades must happen with zero downtime. Kubernetes (often written K8s) is the industry-standard control plane for that. Learning it starts with three building blocks.

In plain terms: Compose is a manager running one kitchen. Kubernetes is a head office running a chain of kitchens: it opens a new branch when the queue grows, replaces a branch that burns down, and rolls out a new menu one branch at a time.

From one machine to a cluster Docker ComposeOne hostHost fails, app is downManual scalingFine for devKubernetesMany nodes, one control planeReschedules after failuresScales on demandRolling zero-downtime updatesSurges, hardware failures and upgrades are what it is built for.Kubernetes is often shortened to K8s: K, 8 letters, s.
Docker Compose runs services on one host. Kubernetes is a control plane over many nodes: it reschedules workloads after failures, scales on demand and performs rolling updates without downtime.

1. Pods: the atomic unit

A Pod is the smallest thing Kubernetes schedules. It wraps one or more tightly coupled containers that share a network address and can share storage volumes. An inference Pod usually pairs the model server with a sidecar container that handles logging, telemetry or request sanitising.

A Pod: containers that live together Inference PodModel servervLLM, FastAPISidecarlogging, telemetryShared: one network address and shared volumeslocalhost works between the containersThe Pod is the smallest unit Kubernetes schedules.Pods are disposable. Something else keeps the right number alive.
A Pod is the smallest unit Kubernetes schedules. An inference Pod usually pairs the model server with a sidecar container for logging or telemetry. The containers share one network address and can share volumes.

2. Deployments: updates and self-healing

You rarely create Pods by hand. A Deployment declares what you want, for example "three replicas of this model server image", and a controller keeps reality matching that.

  • Rolling updates. When you change the model version or a prompt template, the Deployment starts new Pods, waits for their readiness checks to pass, then retires the old ones, so in-flight requests are not dropped.
  • Self-healing. If a heavy context pushes a container past its memory limit and it is killed (OOMKilled), Kubernetes restarts or replaces it to bring the count back to what you declared.
A Deployment rolls out updates safely Deployment: keep 3 replicas of model-server v2Pod 1v1v2 readyPod 2v1v2 readyPod 3v1v2 readyNew Pods start, pass readiness, then old ones stop.In-flight requests are drained, not dropped.Self-healing: a Pod runs out of memory (OOMKilled)Kubernetes restarts or replaces it to restore 3 replicas
A Deployment keeps the declared number of Pod replicas running. For an update it starts new Pods, waits for their readiness checks, then stops old ones so in-flight requests are not dropped. If a Pod is killed for running out of memory, Kubernetes restarts or replaces it to restore the desired count.

3. Services: one stable address

Pods come and go, and each new Pod gets a new IP. A Service sits in front of them with a stable virtual IP and DNS name.

  • ClusterIP exposes the model only inside the cluster, so internal applications can reach it while it stays hidden from the public internet.
  • Readiness-aware routing. The Service only sends traffic to Pods that pass their readiness probe. If a Pod is busy and its readiness check starts failing, new requests go to its idle siblings. Tune the probe to your model server, since a probe that is too strict can take every Pod out of rotation at once.
A Service gives Pods one stable address Appcalls model-svcServiceClusterIPmodel-svc:80Pod 1ReadyPod 2Busy: not readyPod 3ReadyOnly Pods that pass their readiness probe get traffic.ClusterIP keeps the model private inside the cluster.
A Service gives a changing set of Pods one stable virtual IP and DNS name. With a ClusterIP the model is reachable only inside the cluster. The Service sends traffic only to Pods that pass their readiness probe, so a Pod that reports itself busy is skipped.

Here is a compact example. It assumes an image called model-api that serves a /health endpoint on port 8000. Adjust the names, resources and probe to your own server.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: model-api
spec:
  replicas: 3
  selector:
    matchLabels: { app: model-api }
  strategy:
    rollingUpdate: { maxUnavailable: 0, maxSurge: 1 }   # never drop capacity during an update
  template:
    metadata:
      labels: { app: model-api }
    spec:
      containers:
        - name: model-api
          image: registry.example.com/model-api:1.4.0
          ports: [{ containerPort: 8000 }]
          resources:
            requests: { cpu: "2", memory: 8Gi }
            limits:   { memory: 8Gi }                   # exceeding this gets the container OOMKilled
          readinessProbe:
            httpGet: { path: /health, port: 8000 }
            periodSeconds: 5
---
apiVersion: v1
kind: Service
metadata:
  name: model-svc
spec:
  type: ClusterIP            # reachable only inside the cluster
  selector: { app: model-api }
  ports: [{ port: 80, targetPort: 8000 }]

Apply it with kubectl apply -f model.yaml, and inside the cluster your application calls http://model-svc. These three abstractions are the baseline for scaling AI microservices with automated resilience.

Coming Up Next

Day 20: Persistent storage in Kubernetes: managing state, weights and vector indices.

#Kubernetes #K8s #MLOps #DevOps #CloudNative