Kubectl wait: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=Internal= * kubectl")
 
Line 2: Line 2:


* [[Kubectl#Commands|kubectl]]
* [[Kubectl#Commands|kubectl]]
Wait for a specific condition on one or many resources.
The command takes multiple resources and waits until the specified condition is seen in the Status field of every given
resource.
Alternatively, the command can wait for the given set of resources to be deleted by providing the "delete" keyword as
the value to the --for flag.
A successful message will be printed to stdout indicating when the specified condition has been met. One can use -o
option to change to output destination.
Examples:
  # Wait for the pod "busybox1" to contain the status condition of type "Ready".
  kubectl wait --for=condition=Ready pod/busybox1
  # Wait for the pod "busybox1" to be deleted, with a timeout of 60s, after having issued the "delete" command.
  kubectl delete pod/busybox1
  kubectl wait --for=delete pod/busybox1 --timeout=60s
Options:
      --all=false: Select all resources in the namespace of the specified resource types
  -A, --all-namespaces=false: If present, list the requested object(s) across all namespaces. Namespace in current
context is ignored even if specified with --namespace.
      --allow-missing-template-keys=true: If true, ignore any errors in templates when a field or map key is missing in
the template. Only applies to golang and jsonpath output formats.
      --field-selector='': Selector (field query) to filter on, supports '=', '==', and '!='.(e.g. --field-selector
key1=value1,key2=value2). The server only supports a limited number of field queries per type.
  -f, --filename=[]: identifying the resource.
      --for='': The condition to wait on: [delete|condition=condition-name].
  -o, --output='': Output format. One of:
json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file.
  -R, --recursive=true: Process the directory used in -f, --filename recursively. Useful when you want to manage related
manifests organized within the same directory.
  -l, --selector='': Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)
      --template='': Template string or path to template file to use when -o=go-template, -o=go-template-file. The
template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
      --timeout=30s: The length of time to wait before giving up.  Zero means check once and don't wait, negative means
wait for a week.
Usage:
  kubectl wait ([-f FILENAME] | resource.group/resource.name | resource.group [(-l label | --all)]) [--for=delete|--for
condition=available] [options]
Use "kubectl options" for a list of global command-line options (applies to all commands).
Ovidiu-Feodorov:~ ovidiufeodorov$

Revision as of 16:26, 20 September 2019

Internal

Wait for a specific condition on one or many resources.

The command takes multiple resources and waits until the specified condition is seen in the Status field of every given

resource.

Alternatively, the command can wait for the given set of resources to be deleted by providing the "delete" keyword as

the value to the --for flag.

A successful message will be printed to stdout indicating when the specified condition has been met. One can use -o

option to change to output destination.

Examples:

 # Wait for the pod "busybox1" to contain the status condition of type "Ready".
 kubectl wait --for=condition=Ready pod/busybox1
 # Wait for the pod "busybox1" to be deleted, with a timeout of 60s, after having issued the "delete" command.
 kubectl delete pod/busybox1
 kubectl wait --for=delete pod/busybox1 --timeout=60s

Options:

     --all=false: Select all resources in the namespace of the specified resource types
 -A, --all-namespaces=false: If present, list the requested object(s) across all namespaces. Namespace in current

context is ignored even if specified with --namespace.

     --allow-missing-template-keys=true: If true, ignore any errors in templates when a field or map key is missing in

the template. Only applies to golang and jsonpath output formats.

     --field-selector=: Selector (field query) to filter on, supports '=', '==', and '!='.(e.g. --field-selector

key1=value1,key2=value2). The server only supports a limited number of field queries per type.

 -f, --filename=[]: identifying the resource.
     --for=: The condition to wait on: [delete|condition=condition-name].
 -o, --output=: Output format. One of:

json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file.

 -R, --recursive=true: Process the directory used in -f, --filename recursively. Useful when you want to manage related

manifests organized within the same directory.

 -l, --selector=: Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)
     --template=: Template string or path to template file to use when -o=go-template, -o=go-template-file. The

template format is golang templates [1].

     --timeout=30s: The length of time to wait before giving up.  Zero means check once and don't wait, negative means

wait for a week.

Usage:

 kubectl wait ([-f FILENAME] | resource.group/resource.name | resource.group [(-l label | --all)]) [--for=delete|--for

condition=available] [options]

Use "kubectl options" for a list of global command-line options (applies to all commands). Ovidiu-Feodorov:~ ovidiufeodorov$