ML in Practice — Lightweight MLOps
Back to Serving and Deployment

Containerization and Deployment (Docker, Kubernetes)

Docker locks the environment; Kubernetes (or simpler alternatives) runs the container. The lightweight version of cloud-native ML. FIND_VIDEO: search 'docker machine learning deployment' — recommended channel: Made with ML / Docker docs. Aim for 11 min or under.

21 minutesVideo LessonPDF notes
🎯 Free Guest Mode: You are learning for free. Sign in to save your completion progress and quiz answers.
Loading progress...

Key moments

  1. FastAPI ML Architecture — Review the serialized logistic regression model, Pydantic input schemas, and the prediction endpoint.
  2. Dockerfile Construction — Configure image layers, install dependencies, expose port 8000, and define the Uvicorn entry point.
  3. Docker Hub Publishing — Build the container image locally, authenticate with Docker Hub, tag the version, and push it remotely.
  4. Kubernetes Architecture — Start a local Minikube cluster and analyze request routing across Deployments, Pods, and Services.
  5. Deployment Configuration — Draft a declarative YAML manifest specifying 3 replicas, matching labels, and remote image references.
  6. Service Configuration — Create a NodePort Service manifest to route external port 80 traffic to internal container port 8000.
  7. Cluster Deployment & Validation — Apply the manifests to the cluster and inspect pod, deployment, and service states using kubectl CLI.
PDF notes

Frequently asked questions

Why does my Kubernetes Service report no endpoints despite pods running successfully?

Check your YAML labels; the `spec.selector` in your Service must exactly match the key-value pairs defined in `spec.template.metadata.labels` of your Deployment.

Why should requirements.txt be copied separately before copying the rest of the application code?

Docker caches filesystem layers sequentially; copying dependency manifests separately prevents running slow package installations every time source code changes.

What happens when a pod crashes in a Deployment with replicas set to 3?

The Deployment controller detects the observed count is 2 and immediately schedules a replacement pod to restore the desired state.

How was this lesson?

Your feedback helps us refine explanations and catch bugs.