Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- DHCP
- OSI 7 layer
- 장비
- ospfv3
- OSPF
- crontab
- 헤더
- stp
- tunneling
- vrrp
- 스위치
- Chrony
- Redistribute
- Inter VLAN
- eigrp
- ipv6
- GLBP
- Vlan
- 명령어
- eigrpv2
- rip
- NAT
- 라우터
- Etherchannel
- CKA
- ripng
- ACL
Archives
- Today
- Total
Net Eng
[CKA] - Pod Log 추출 본문
[선수 지식]
kubectl logs POD
kubectl logs POD -c CONTAINER
[선수 작업]
kubectl config set-context hk8s --user=kubernetes-admin --cluster=kubernetes
mkdir -p /var/CKA2023
kubectl apply -f - <<EOF
kind: Pod
apiVersion: v1
metadata:
name: custom-app
spec:
containers:
- name: custom-container
image: busybox
command:
- '/bin/sh'
- '-c'
- >
while true;
do
[ ! -f /filenotfound.txt ] && echo "[ ERROR ] file not found";
sleep 10;
done
EOF
[문제]
작업 클러스터: hk8s
Monitor the logs of pod custom-app and: Extrat log lines corresponding to error file not found. Write them to /var/CKA2023/podlog.
[풀이]
kubectl config use-context hk8s
* hk8s 클러스터 사용
kubectl get pods custom-app
* Pod 확인
kubectl logs custom-app | grep 'file not found'
* file not found가 포함된 log 확인
kubectl logs custom-app | grep 'file not found' > /var/CKA2023/podlog
* 해당 로그를 파일에 기록

[참고]
명령줄 도구 (kubectl)
운영 수준의 컨테이너 오케스트레이션
kubernetes.io
'Cloud > Kubernetes' 카테고리의 다른 글
[CKA] - Init Container를 포함한 Pod 운영 (1) | 2024.01.22 |
---|---|
[CKA] - CPU 사용량이 높은 파드 검색 (1) | 2024.01.21 |
[CKA] - Deployment & Expose the Service (0) | 2024.01.21 |
[CKA] - Node 정보 수집 (0) | 2024.01.21 |
[CKA] - Node 관리 (0) | 2024.01.21 |