Interview Prep/Python for DevOps/Testing, CI/CD, packaging & services

You must make a FastAPI service production-ready for Kubernetes. What is your checklist?

AdvancedScenarioTesting, CI/CD, packaging & services
Answer

Situation read → From "works locally" to operable.

What I'd do →

  1. Run with uvicorn (or gunicorn with uvicorn workers), exec-form entrypoint, non-root user, slim image.
  2. /healthz (no dependencies) and /readyz (dependencies with short timeouts) wired to probes.
  3. JSON logs to stdout with request IDs; /metrics with request count and latency histograms.
  4. Graceful shutdown: handle SIGTERM, a preStop sleep for endpoint propagation.
  5. Resource requests and limits, config from env, secrets from a secret store.
  6. Timeouts on every outbound call.

Why → These are the properties every reliable service on Kubernetes needs.

Interview tip → The preStop sleep detail shows deep Kubernetes knowledge.

All Python for DevOps questions Roadmap: Python for automation

More on Testing, CI/CD, packaging & services