← All insightsArchitecture

The twelve-factor app, revisited for modern DevOps

CodeWizard Academy · 10 July 2025 · 3 min read · Intermediate

The twelve-factor app predates Kubernetes, yet it still explains why some services are trivial to deploy and scale while others fight you at every step. Here are the factors that matter most in a container world.

Config in the environment

Keep config out of the code and inject it as environment variables. In Kubernetes, that means ConfigMaps and Secrets mounted as env, not values baked into the image.

yaml
env:
  - name: DATABASE_URL
    valueFrom: { secretKeyRef: { name: db, key: url } }
  - name: LOG_LEVEL
    valueFrom: { configMapKeyRef: { name: app, key: log_level } }

Stateless processes and disposability

Processes should be stateless and disposable - fast to start, graceful to stop. Store state in backing services (databases, object storage, Redis), and handle SIGTERM so rolling updates do not drop requests.

  • Treat backing services as attached resources swapped via config
  • Build, release and run are strictly separated stages
  • Logs are event streams to stdout, not files you manage
  • Admin tasks run as one-off processes in the same environment
If a service is hard to deploy, it usually violates two or three factors. Fix those and the operations problem quietly disappears.

You do not need to worship all twelve. But when a service is painful to run, walk the list - the culprit is almost always there.

Like where this is going?

Get hands-on help from the engineers who write these posts.

Book a free consult