kubectl-wait
blocks until conditions are met
TLDR
SYNOPSIS
kubectl wait [options] resource
DESCRIPTION
kubectl wait blocks execution until one or more Kubernetes resources reach a specified condition, making it an essential synchronization primitive for shell scripts, CI/CD pipelines, and automation workflows. Rather than polling with repeated `kubectl get` calls, it efficiently watches the resource and returns as soon as the condition is satisfied or the timeout expires.The command supports built-in condition checks such as `condition=Ready` and `condition=Available`, resource deletion events via `--for=delete`, and arbitrary field matching through JSONPath expressions like `jsonpath='{.status.phase}'=Running`. It can target individual resources by name or groups of resources matched by label selectors, and always defaults to a 30-second timeout unless overridden with --timeout.
PARAMETERS
RESOURCE
Resource(s) to wait on, e.g. `pod/busybox`, `deployment/web`, or a type like `pods`.--for EXPR
Condition to wait on. Accepts `create`, `delete`, `condition=<name>[=<value>]`, or `jsonpath='{...}'[=<value>]`. Default condition value is `true`.--timeout DURATION
Maximum time to wait (e.g. 30s, 5m). Default is 30s. Zero means check once; a negative value waits up to a week.--all
Select all resources of the given type in the namespace.-A, --all-namespaces
Operate across all namespaces.-l, --selector QUERY
Label selector to filter resources.--field-selector QUERY
Field selector to filter resources.-f, --filename FILE
Identify the resource(s) via a manifest file or directory.-n, --namespace NS
Target namespace.-o, --output FORMAT
Output format (json, yaml, name, go-template, jsonpath, ...).--help
Display help information.
CAVEATS
Subcommand of kubectl. Blocks execution. Set reasonable timeouts.
HISTORY
kubectl wait provides synchronization for Kubernetes automation and scripting.
SEE ALSO
kubectl(1), kubectl-get(1), kubectl-apply(1), kubectl-rollout(1), kubectl-describe(1)
