Recall & Review
beginner
What does the command
kubectl logs <pod-name> do?It shows the logs (output messages) from the main container inside the specified pod. This helps to see what the application inside the pod is doing or if there are any errors.
Click to reveal answer
beginner
How do you view logs from a specific container in a pod with multiple containers?
Use
kubectl logs <pod-name> -c <container-name> to get logs from the chosen container inside the pod.Click to reveal answer
beginner
What option shows logs continuously as new lines are added?
The
-f or --follow option streams the logs live, like watching a live feed. Example: kubectl logs -f <pod-name>.Click to reveal answer
intermediate
How can you get logs from previous instances of a container that crashed?
Use
kubectl logs <pod-name> -c <container-name> --previous to see logs from the last terminated container.Click to reveal answer
beginner
Why is
kubectl logs useful for debugging?It helps you see what is happening inside your app running in Kubernetes. You can find errors, warnings, or understand app behavior without accessing the pod directly.
Click to reveal answer
Which command streams logs live from a pod?
✗ Incorrect
The -f option in kubectl logs streams logs live as they are generated.
How do you get logs from a specific container in a pod?
✗ Incorrect
The -c option specifies the container name inside the pod for logs.
What does the --previous flag do in kubectl logs?
✗ Incorrect
The --previous flag shows logs from the container instance before it crashed or restarted.
Which command is NOT used to view logs?
✗ Incorrect
kubectl describe shows pod details but not logs.
Why use kubectl logs for debugging?
✗ Incorrect
kubectl logs helps check what the app inside the pod is doing or if it has errors.
Explain how to use kubectl logs to debug a pod with multiple containers.
Think about how to target one container inside a pod.
You got /3 concepts.
Describe how to view logs from a crashed container to find out what went wrong.
Look for logs from the last terminated container.
You got /3 concepts.