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 |
Tags
- crontab
- vrrp
- ripng
- NAT
- eigrpv2
- OSI 7 layer
- CKA
- rip
- DHCP
- 헤더
- eigrp
- Vlan
- ospfv3
- OSPF
- 스위치
- Etherchannel
- Redistribute
- 명령어
- GLBP
- 라우터
- Inter VLAN
- ipv6
- 장비
- Chrony
- tunneling
- ACL
- stp
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 |