DEV Community

Metronom
Metronom

Posted on

Hacker News + dev.to (a concrete '2-5 minutes to a few seconds' DX win is a proven front-page hook)

We got the Kubernetes inner loop from 2–5 minutes back to seconds with Tilt

Chapter 8 of a local-Kubernetes series — the payoff that closes the loop chapter 1 opened. Tilt watches files, rebuilds, deploys, and with Live Update syncs code into a running container in seconds.

Key takeaways

  • The pain, quantified: by hand, every edit is docker build → push → kubectl rollout restart → wait → check logs — a minute or two each. Ten edits = half an hour gone.
  • A Tiltfile is a program, not YAML — it's Starlark (a Python dialect). tilt up executes it top to bottom; edit the Tiltfile and Tilt re-executes it, nothing to restart.
  • The three pillars: docker_build('tag','ctx') (how to build), k8s_yaml('file') (what to deploy), k8s_resource('name', port_forwards=...) (fine-tuning). Tilt matches built images to manifest images by tag and swaps in the fresh build.
  • Live Update is the star: instead of rebuild+redeploy, Tilt copies changed files straight into the running container. Steps run in a strict order — fall_back_onsyncrunrestart_container — and the order can't be broken.
  • Two newbie traps: sync paths must live inside the same docker_build context ("if Tilt is watching it, you can sync it"); run() can't come before sync(). Also: the first deploy is always full — Live Update needs a running container.
  • Hot reload, two scenarios: (A) framework reloads itself — uvicorn --reload --reload-dir app, sync is enough; (B) no reload — use the restart_process extension (docker_build_with_restart), the modern replacement for the deprecated restart_container() on k8s.
  • Dashboard at localhost:10350: per-resource update + runtime status, logs with filtering, endpoints as links, manual Trigger Update, optional TRIGGER_MODE_MANUAL.
  • vs Skaffold/DevSpace: Tilt = UI-first + Starlark + Live Update; Skaffold/DevSpace = CLI-first + YAML. Fair caveat: pick by team taste.

Full article: https://dorokhovich.com/blog/local-k8s-tilt-fast-dev-loop?utm_source=devto&utm_medium=syndication&utm_campaign=local-k8s-tilt-fast-dev-loop

Top comments (0)