CKA (Certified Kubernetes Administrator)/Kode Kloud

03.Logging & Monitoring - Managing Application Logs

seulseul 2022. 1. 20. 16:24
LABS – CERTIFIED KUBERNETES ADMINISTRATOR WITH PRACTICE TESTS >
LOGGING & MONITORING, PRACTICE TEST Managing Application Logs

Logging & Monitoring

01. We have deployed a POD hosting an application. Inspect it. Wait for it to start.

 

02. A user - USER5 - has expressed concerns accessing the application. Identify the cause of the issue.

Inspect the logs of the POD

1) Application Crashed

2) Item Out of Stock

3) Account does not exist

4) Account Locked due to Many Failed Attempts

controlplane ~ ➜  kubectl logs webapp-1 | grep USER5
[2022-01-20 07:10:24,511] WARNING in event-simulator: USER5 Failed to Login as the account is locked due to MANY FAILED ATTEMPTS.

 

03. We have deployed a new POD - webapp-2 - hosting an application. Inspect it. Wait for it to start.

04. A user is reporting issues while trying to purchase an item. Identify the user and the cause of the issue.

Inspect the logs of the webapp in the POD

1) USER1 - Item Out of Stock

2) USER2 - Application Crashed

3) USER30 - Item Out of Stock (정답)

4) USER4 - Account does not exist

kubectl logs webapp-2 --all-container=true
명령어는 간단하게 다음과 같다. 만일 webapp-1이라는 pod의 로그를 보고싶다면
kubectl logs webapp-1
만약에 webapp-2라는 이름을 가진 pod이 두개의 컨테이너에서 돌고있다면 컨테이너 지정을 해줘야한다.
따라서, simple-webapp이라는 컨테이너안의 webapp-2의 로그를 보고싶다면 다음과같은 명령어로 확인한다
kubectl logs webapp-2 -c simple-appweb