HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

kubectl wait — Wait for resource(s) to reach a certain state. More information: <https://kubernetes.io/docs/referen

Submitted by: @import:tldr-pages··
0
Viewed 0 times
resourcecertaincommandwaitkubectl waitclireachfor

Problem

How to use the kubectl wait command: Wait for resource(s) to reach a certain state. More information: <https://kubernetes.io/docs/reference/kubectl/generated/kubectl_wait/>.

Solution

kubectl wait — Wait for resource(s) to reach a certain state. More information: <https://kubernetes.io/docs/reference/kubectl/generated/kubectl_wait/>.

Wait for a deployment to become available:
kubectl wait --for condition=available deployment/{{deployment_name}}


Wait for all pods with a certain [l]abel to be ready:
kubectl wait --for condition=ready pod {{[-l|--selector]}} {{label_key}}={{label_value}}


Wait for a pod to be deleted:
kubectl wait --for delete pod {{pod_name}}


Wait for a job to complete, within 120 seconds (if the condition isn't met on time, the exit status will be unsuccessful):
kubectl wait --for condition=complete job/{{job_name}} --timeout 120s

Code Snippets

Wait for a deployment to become available

kubectl wait --for condition=available deployment/{{deployment_name}}

Wait for all pods with a certain [l]abel to be ready

kubectl wait --for condition=ready pod {{[-l|--selector]}} {{label_key}}={{label_value}}

Wait for a pod to be deleted

kubectl wait --for delete pod {{pod_name}}

Wait for a job to complete, within 120 seconds (if the condition isn't met on time, the exit status will be unsuccessful)

kubectl wait --for condition=complete job/{{job_name}} --timeout 120s

Context

tldr-pages: common/kubectl wait

Revisions (0)

No revisions yet.