Video Thumbnail for Lesson
10.1: Developer Iteration (Tilt)

Developer Iteration (Tilt)

When developing for Kubernetes we want the feedback loop to be as short as possible. Tools like Tilt, Skaffold, Telepresence and mirrord can watch your code, build new images and update your cluster automatically. In this lesson we will focus on Tilt and show how it can streamline local development.

Why use Tilt?

  • Running processes directly on your machine often differs from the real cluster.
  • Docker Compose brings containers closer but still lacks Kubernetes features such as ingress resources.
  • Tilt lets you develop against a real cluster and rebuild services whenever files change.

Project structure

The code for this lesson lives in the course repository. Inside the 10-developer-experience/tilt directory you will find a top‑level Tiltfile:

include('../../06-demo-application/api-golang/Tiltfile')
include('../../06-demo-application/api-node/Tiltfile')
include('../../06-demo-application/client-react/Tiltfile')
include('../../06-demo-application/load-generator-python/Tiltfile')

Each service has its own Tiltfile. The Node API version looks like this:

docker_build(
  'sidpalas/devops-directive-docker-course-api-node',
  './',
)
k8s_yaml('../../07-deploying-demo-application/api-node/Deployment.yaml')
k8s_resource('api-node', port_forwards=3000)

The Golang API uses the ko extension instead of docker_build:

load('ext://ko', 'ko_build')
ko_build(
  'sidpalas/devops-directive-docker-course-api-golang',
  './',
  deps=['.'],
)

Running Tilt

  1. Start a local kind cluster and deploy the base resources (Postgres, Traefik, etc.) from earlier modules.
  2. From the tilt directory run tilt up. Tilt opens a browser interface that shows each service being built and deployed.
  3. Edit a file within any service and save. Tilt automatically rebuilds the image and updates the Kubernetes deployment.
  4. Use the Tilt UI to view logs from all services or drill into a single resource. Port forwards defined in the Tiltfile allow you to test the services via localhost.

Tilt supports live updates to sync files directly into running containers. For interpreted languages this can avoid a full image rebuild. For compiled languages you can sync the build artifacts and restart the process. Refer to the Tilt documentation for tips on optimizing build times.

Summary

Tilt greatly reduces the time between writing code and seeing it run in Kubernetes. By developing against a real cluster you uncover issues in manifests, networking and ingress early in the process. Explore Tilt or similar tools like Skaffold, Telepresence and mirrord to find the workflow that best fits your team.