
Using Stern for viewing Kubernetes logs
10 jul 2019 | deployment | kubernetes | logs
In my post of yesterday, I introduced you to the kail
utility to follow Kubernetes logfiles.
Today, I found a similar utilty called Stern
which does the same thing but in a better way.
You can install it as follows (on a mac):
$ brew install stern
There are a number of reasons why I prefer Stern over Kail:
- The output coloring is much better
- You can easily format the output (read: remove the stuff you don't want to see)
- It shows the names of the pods which are stopped and the ones which are starting
In my case, I'm for example only interested in seeing the pod name:
$ stern staging --template '{{.PodName}} | {{.Message}}'
You can find more information about Stern here.