DEV Community

Hacker News + Reddit r/kubernetes (the compose-as-anti-pattern claim is the debate magnet that earns comments)

Introduction

docker-compose is not a production stand-in - and here's the receipt Chapter 2 of a local-Kubernetes series. The thesis is opinionated on purpose: a production-like local environment is not one where everything is like prod - it's one where you know exactly what matches, what doesn't, and why.

Key Takeaways

  • "Production-like" โ‰  "a copy of prod." You can't fit prod on a laptop and you don't need to. The goal is deliberately narrowing the dev/prod gap so packaging and deployment bugs get caught on your machine.
  • The gap has a name. Twelve-Factor's tenth factor (Dev/prod parity) calls out three gaps - time, personnel, and tools. It's the tools gap that makes "worked in dev, failed in prod."
  • Parity comes down to three things: the same Kubernetes minor version, the same backing services by type and version (Postgres, not SQLite), and the same real manifests you deploy with in prod.
  • Version-pinning gotcha: Docker tags can't contain +, so you pin k3s as rancher/k3s:v1.31.5-k3s1, not v1.30.2+k3s1. With kind, pin the node image by sha256 digest from the release notes.
  • Reproduce on purpose: K8s version, backing services, requests/limits, liveness/readiness/startup probes, ConfigMap/Secret, Ingress + service discovery.
  • Simplify on purpose: scale/topology, managed cloud services (run the OSS equivalent), load testing.
  • Why compose can't validate your manifests: per Kompose's own docs, depends_on is ignored, build: doesn't build an image, bind mounts aren't preserved, and the output has no requests/limits, no probes, and env vars in plaintext instead of Secrets. "99% of the way there" is still a draft, not a prod manifest.

Ends with a shareable "how production-like is my local setup" checklist.

Full article: https://dorokhovich.com/blog/local-k8s-production-like-environments?utm_source=devto&utm_medium=syndication&utm_campaign=local-k8s-production-like-environments

Top comments (0)

Comments

No comments yet. Start the discussion.