This project demonstrates how to run Temporal workers on Kubernetes with Prometheus metrics, Grafana dashboards, and automated versioned rollouts via the temporal-worker-controller.
- Temporal Go worker with Prometheus metrics (tally/histogram)
- Resource-based tuner + poller autoscaling
- Worker versioning via
TemporalWorkerDeployment(AllAtOnce rollout) - Prometheus scraping worker metrics + Temporal Cloud metrics
- Grafana dashboards provisioned via Terraform
- Go 1.23+
- Docker
- kind
- kubectl
- Helm v3
- Skaffold
- Terraform
- Temporal Cloud metrics API key in
temporal-certs/api_key_metrics
./bootstrap.shThis will:
- Create a local kind cluster
- Create the Prometheus API key secret in k8s
- Fetch Helm chart dependencies (
helm dependency buildfromhelm/temporal/) - Build worker + starter images and deploy everything via Skaffold (including the temporal-worker-controller)
- Provision Grafana dashboards via Terraform
- Optionally launch workflow load
Access:
- Grafana: http://localhost:30030 (admin/admin)
- Prometheus: http://localhost:30090
- Temporal UI: http://localhost:30233
WorkerDeployment
└─ managed by temporal-worker-controller
└─ creates/manages Deployment pods (versioned)
└─ worker exposes :8079/metrics
└─ scraped by Prometheus → Grafana
The worker reads TEMPORAL_WORKER_BUILD_ID and TEMPORAL_DEPLOYMENT_NAME injected by the controller and enables worker versioning automatically. When running locally without the controller these env vars are absent and versioning is skipped.
The helm/temporal chart depends on temporal-worker-controller via OCI. Run the build from inside that directory — running it from the project root will fail with a misleading file-size error:
cd helm/temporal && helm dependency build# Build, push to kind, and deploy (one-shot)
skaffold run
# Continuous dev loop with file watching
skaffold devskaffold run --set-value starter.enabled=truecd golang
go run prometheus/worker/main.go -target-host=localhost:7233cd auto
# local docker-compose
terraform apply -var-file=local.tfvars
# kind / k8s
terraform apply -var-file=k8s.tfvarsgit subtree add --prefix=dashboards https://github.com/temporalio/dashboards.git master --squash
git subtree pull --prefix=dashboards https://github.com/temporalio/dashboards.git master --squash