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 thenearest directory containing a kustomization file recognized by kubectl(kustomization.yaml, kustomization.yml, or Kustomization), walking upfrom the changed file to the watch root. If no kustomization boundary isfound, or the boundary is the watch root, it applies the full rootdirectory. This scoping ensures only the affected Kustomize layer isre-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 ofthe watch directory before entering the watch loop. This is useful afterediting manifests offline or when starting a fresh session.
Use --hook to run shell commands before each apply (e.g. docker build).Hooks execute sequentially; if any hook fails the apply is skipped forthat cycle. Hooks can also be configured in ksail.yaml underspec.workload.watch.hooks. CLI --hook flags are appended after config hooks.
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
# Run a build before each apply ksail workload watch --hook "docker build -t myapp:latest ."
# Chain multiple hooks ksail workload watch --hook "make generate" --hook "docker build -t myapp ."
Usage: ksail workload watch [flags]
Flags: --debug Show diagnostic output for file events and polling (useful for troubleshooting watch behavior) --hook stringArray Shell command to run before each apply (repeatable; appended after spec.workload.watch.hooks) --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.