IT 기술/k8s
[cka] Managing Application Logs
Geunny
2024. 6. 24. 21:20
반응형
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 13s
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
[2024-06-24 12:12:55,531] INFO in event-simulator: USER2 is viewing page2
[2024-06-24 12:12:56,533] INFO in event-simulator: USER2 logged in
[2024-06-24 12:12:57,534] INFO in event-simulator: USER2 is viewing page2
[2024-06-24 12:12:58,535] INFO in event-simulator: USER4 logged in
...
[2024-06-24 12:14:00,659] WARNING in event-simulator: USER5 Failed to Login as the account is locked due to MANY FAILED ATTEMPTS.
answer : account is 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 3m3s
webapp-2 2/2 Running 0 21s
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
Defaulted container "simple-webapp" out of: simple-webapp, db
...
[2024-06-24 12:15:40,528] WARNING in event-simulator: USER5 Failed to Login as the account is locked due to MANY FAILED ATTEMPTS.
..
[2024-06-24 12:15:43,532] WARNING in event-simulator: USER30 Order failed as the item is OUT OF STOCK.
..
answer : USER30 - item is OUT OF STOCK