Watch Command - 01-27-20

Currently at work we occasionally have to redeploy pods that have the same image tag but different SHA hashes. The problem stems from the k8s deployments not picking up the changes and thus a manually killing of the production pods is required. When they are restarted the SHA is checked and new image pulled, during this process I like to watch along at the running pods to make sure things are going smoothly.

I use to use the built in watch argument of k8s get pods command -w:

$ kubectl get pods -n shop -w

But this produces a really cluttered terminal output so I started just running the command on loop

$ while true; do; kubectl get pods -n shop ; sleep 5; done

Then a coworker showed me the watch command which has a much cleaner interface and outputs to a much clearer less/more like non scrolling output.

$ watch -n 5 'kubectl get pods -n shop'

The watch command is availble via brew

$ brew install watch


\- [ watch ]