Migrate from Docker Compose on a single VM to Kubernetes. What changes?

BeginnerScenarioMigrations
Answer

Situation read → Compose assumes one host; Kubernetes assumes pods can move anywhere at any time.

What I'd do →

  1. Translate services to Deployments and Services (Kompose can give a starting point, but hand-tune the result).
  2. Replace bind mounts and local volumes: config to ConfigMaps and Secrets, data to PersistentVolumes or, better, managed services (RDS instead of a Postgres container).
  3. Replace depends_on with readiness probes and retry logic in the app.
  4. Add resource requests and limits, health probes, and multiple replicas.
  5. Ingress replaces published ports; set up TLS with cert-manager.
  6. Move logs to stdout and ship them with a node-level agent.

Why → Compose's implicit assumptions (shared disk, fixed IPs, startup order) break in Kubernetes.

Interview tip → "Don't migrate the database container, move it to a managed service" is the practical advice.

All Real-World Interview questions Roadmap: Interview readiness

More on Migrations