2025-03-14 21:59:59 -06:00
|
|
|
# kubectl wait
|
|
|
|
|
|
|
|
|
|
> Wait for resource(s) to reach a certain state.
|
2025-12-16 10:20:31 -07:00
|
|
|
> More information: <https://kubernetes.io/docs/reference/kubectl/generated/kubectl_wait>.
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Wait for a deployment to become available:
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`kubectl wait --for condition=available deployment/{{deployment_name}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Wait for all pods with a certain [l]abel to be ready:
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`kubectl wait --for condition=ready pod {{[-l|--selector]}} {{label_key}}={{label_value}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Wait for a pod to be deleted:
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`kubectl wait --for delete pod {{pod_name}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Wait for a job to complete, within 120 seconds (if the condition isn't met on time, the exit status will be unsuccessful):
|
|
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`kubectl wait --for condition=complete job/{{job_name}} --timeout 120s`
|