Post

[Kubernetes] kubetail

[Kubernetes] kubetail
  • 여러 POD의 로그를 동시에 조회하는 기능
  • kubectl logs -f를 실행하는 것과 동일하지만 여러 Pod에 적용

Install Ubuntu

1
sudo apt install kubetail

Install Mac OS

1
brew tap johanhaleby/kubetail && brew install kubetail

kubetail에 대한 설정 방법은 설치 문서를 참고하시기 바랍니다.

How to use

Container or Multiple Containers

1
2
kubetail app2 -c container1
kubetail app2 -c container1 -c container2

Multiple Apps(pods)

1
kubetail app1,app2

Deployment or DaemonSet

1
2
3
4
kubetail "coredns-556f6dffc4-*" -n kube-system
Will tail 2 logs...
coredns-556f6dffc4-bd2mr
coredns-556f6dffc4-hbvdt

Label selector.

1
2
kubetail --selector service=my-service --since 10m
kubetail --selector release=p-jm-han

Regex

1
2
3
4
5
6
7
8
9
10
11
kubetail "^app1|.*my-demo.*" --regex

kubetail '.*loki-read-*|.*loki-write-*' -n monitoring --regex
Using regex '.*loki-read-*|.*loki-write-*' to match pods
Will tail 6 logs...
loki-read-0
loki-read-1
loki-read-2
loki-write-0
loki-write-1
loki-write-2

[명령어] –help를 입력하면 더 다양한 옵션들을 찾을 수 있다.

This post is licensed under CC BY 4.0 by the author.