Skip to content

Commit 0475bd2

Browse files
committed
Show logging messages of a pod or an app
This commits shows how to get the log messages from a pod or an application in Kubernetes based cluster.
1 parent 9d9c9b4 commit 0475bd2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

K8s/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ Using options `-o wide` and `--show-labels=true`, we can combine different types
1313
kubectl -n bmdev get pvc,svc,po,deployment,ingress,configmap --show-labels=true -o wide
1414
```
1515

16+
### How to show logs from a pod or an application
17+
We usually run `kubectl logs -f jummp-7d9df54b74-5tk5g` where `jummp-7d9df54b74-5tk5g` is the name of your specific pod. However, if your application has been replicated multiple nodes, it means that we tend to see the logs produced from these pods, i.e. this application, instead of a specific pod. In this situation, we should add the option `-l app=jummp` to tell K8s client where it has to get the logs. In this example, `-l` means enabling the label `app=jummp`. The full command looks like:
18+
19+
```
20+
kubectl logs -f -l app=jummp
21+
```
1622

1723
### How to manage multiple installed versions of kubectl
1824
Read

0 commit comments

Comments
 (0)