본문 바로가기
IT 잡지식/DevOps

[CKA] KodeKloud - Managing Application Logs

by 쯀리♥️ 2024. 6. 25.

안녕하세요, 쯀리입니다.

오늘은 Application logs를 Managing하는 방법을 알아보겠습니다.  

https://kubernetes.io/docs/reference/kubectl/generated/kubectl_logs/

 

kubectl logs

Production-Grade Container Orchestration

kubernetes.io

 


 

Quiz.

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

controlplane ~ ➜  k get pods
NAME       READY   STATUS    RESTARTS   AGE
webapp-1   1/1     Running   0          24s


2. A user - USER5 - has expressed concerns accessing the application. Identify the cause of the issue.
Inspect the logs of the POD

controlplane ~ ➜  k logs webapp-1 | grep USER5
[2024-06-25 09:13:10,695] WARNING in event-simulator: USER5 Failed to Login as the account is locked due to MANY FAILED ATTEMPTS.
[2024-06-25 09:13:15,700] WARNING in event-simulator: USER5 Failed to Login as the account is locked due to MANY FAILED ATTEMPTS.
[2024-06-25 09:13:20,705] WARNING in event-simulator: USER5 Failed to Login as the account is locked due to MANY FAILED ATTEMPTS.
[2024-06-25 09:13:25,711] WARNING in event-simulator: USER5 Failed to Login as the account is locked due to MANY FAILED ATTEMPTS.

Account Locked due to Many Failed Attempts.

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

controlplane ~ ➜  k get pods
NAME       READY   STATUS    RESTARTS   AGE
webapp-1   1/1     Running   0          2m39s
webapp-2   2/2     Running   0          11s

 

4. 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

controlplane ~ ➜  k logs webapp-2 | grep WARNING
Defaulted container "simple-webapp" out of: simple-webapp, db
[2024-06-25 09:15:36,347] WARNING in event-simulator: USER5 Failed to Login as the account is locked due to MANY FAILED ATTEMPTS.
[2024-06-25 09:15:39,350] WARNING in event-simulator: USER30 Order failed as the item is OUT OF STOCK.

USER30 Order failed as the item is OUT OF STOCK

 

 


이렇게 3강의 Logging 과 Monitoring 방법을 살펴보았습니다. 
다음부터는 4강의 Application Lifecycle Management에 관해 알아보도록 하겠습니다 .

 


참조

 Udemy Labs - Certified Kubernetes Administrator with Practice Tests