watch

Watching for Object Changes

Continuously Watch and print Resources as they change

Print Resources as they are updated.

It is possible to have kubectl get continuously watch for changes to objects, and print the objects when they are changed or when the watch is reestablished.

Command

  1. kubectl get deployments --watch

Output

  1. NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
  2. nginx 1 1 1 1 6h
  3. nginx2 1 1 1 1 21m

Watch Timeouts

Watch timesout after 5 minutes, after which kubectl will re-establish the watch and print the resources.

It is possible to have kubectl get continuously watch for changes to objects without fetching them first using the --watch-only flag.

Command

  1. kubectl get deployments --watch-only