add the old snippet md files
This commit is contained in:
parent
fc0dd204c7
commit
bcf8313a4b
110 changed files with 3048 additions and 0 deletions
44
old_snippets/watch-command.en.md
Normal file
44
old_snippets/watch-command.en.md
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
---
|
||||
title: "watch command"
|
||||
date: 2020-01-27T15:47:22+01:00
|
||||
draft: false
|
||||
snippet_types: ["watch"]
|
||||
---
|
||||
|
||||
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**:
|
||||
|
||||
|
||||
```shell
|
||||
$ kubectl get pods -n shop -w
|
||||
```
|
||||
|
||||
But this produces a really cluttered terminal output so I started just running the command on loop
|
||||
|
||||
```shell
|
||||
$ 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.
|
||||
|
||||
|
||||
```shell
|
||||
$ watch -n 5 'kubectl get pods -n shop'
|
||||
```
|
||||
|
||||
The watch command is availble via brew
|
||||
|
||||
```shell
|
||||
$ brew install watch
|
||||
```
|
||||
|
||||
source:
|
||||
|
||||
https://gitlab.com/procps-ng/procps/blob/master/watch.c
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue