Notice
Recent Posts
Recent Comments
Link
«   2026/06   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
Tags more
Archives
Today
Total
관리 메뉴

holssi 님의 블로그

[CKA] 기출문제 pod 로그 추출 본문

CKA

[CKA] 기출문제 pod 로그 추출

holssi 2026. 1. 14. 15:26

작업 클러스터는 k8s이고, 파드 custom-app의 Log를 모니터링하고, file not found 메시지를 포함하는 Log 라인 추출하기

추출된 결과는 /opt/REPORT/2026/custom-app-log에 기록하기

 

0. 클러스터 전환

kubectl config use-context k8s
kubectl config current-context

 

1. custom-app 파드 모니터링하기

kubectl logs custom-app

 

2. 특정 메시지 추출 후 지정 경로에 저장

# file not found 라는 메시지를 추출
kubectl logs custom-app | grep "file not found"

# 지정 경로에 메시지 저장 후 확인
kubectl logs custom-app | grep "file not found" > /opt/REPORT/2026/custom-app-log