Skip to content

ksail workload watch

Watch a directory for file changes and automatically apply workloads.
When files in the watched directory are created, modified, or deleted,
the command debounces changes (~500ms) then scopes the apply to the
nearest directory containing a kustomization file recognized by kubectl
(kustomization.yaml, kustomization.yml, or Kustomization), walking up
from the changed file to the watch root. If no kustomization boundary is
found, or the boundary is the watch root, it applies the full root
directory. This scoping ensures only the affected Kustomize layer is
re-applied, making iteration faster in monorepo-style layouts.
Each reconcile prints a timestamped status line showing the changed file,
the outcome (success or failure), and the elapsed time for the apply.
Press Ctrl+C to stop the watcher.
Use --initial-apply to synchronize the cluster with the current state of
the watch directory before entering the watch loop. This is useful after
editing manifests offline or when starting a fresh session.
Examples:
# Watch the default k8s/ directory
ksail workload watch
# Watch and apply once on startup before entering the loop
ksail workload watch --initial-apply
# Watch a custom directory
ksail workload watch --path=./manifests
Usage:
ksail workload watch [flags]
Flags:
--debug Show diagnostic output for file events and polling (useful for troubleshooting watch behavior)
--initial-apply Apply all workloads once immediately on startup before entering the watch loop
--path string Directory to watch for changes (default: k8s/ or spec.workload.sourceDirectory from ksail.yaml)
Global Flags:
--benchmark Show per-activity benchmark output
--config string Path to config file (default: ksail.yaml found via directory traversal)

For image rebuild automation and local↔remote traffic bridging, see the Companion Tools guide.