stern 사용법

문학적인유사성·2024년 3월 2일
0

뎁옵깃옵쿠베

목록 보기
45/46

일반적인 오류 확인

개인적으로 쿠버에서 오류가 생기면 아래와같은 것들을 확인을 하고있다.

  1. kubectl get pods -o yaml
  • yaml 설정 확인
  1. kubectl logs pods ~~
  • pod의 log 확인
  1. kubectl describe pods ~~~
  • pods 설명 확인 ( image pull이 안된다던가, 이런 오류들을 바로 알수있음 )
  1. kubectl describe deployments ~~~
  • deploy 라벨이나 deploy에 문제가 있는 것들을 확인 할수있음
  1. kubectl describe svc ~~~
  • svc 포트나 라벨 같은 것들을 확인
  1. kubectl describe ingress ~~~
  • ingress에서 문제를 확인

위에서 logs 문제는 단일 컨테이너만 확인이 가능해서 문제가 있음..
이를 해결해주는게 stern이라는 툴이였다.

stern

설치

github binary 링크들어가서, 설치파일을 받아서 반입

아래와 같이 바로 확인이 가능함.
정규식을 지원해서, --exclude-container, --container, --selector, -n, -i 이걸 제일 많이 쓴 것같다.

stern -n kube-system --exclude-pod kube-apiserver 
stern -n my-namespace my-pod --container my-container
stern deployment/my-deployment
stern deployment/my-app -i '.*"status":"error".*'

stern docs 정규식 참고용
뭐 이런식으로 쓰고있음...

0개의 댓글