Bird
0
0

Given the command kubectl logs mypod --tail=5, what will be the output?

medium📝 Command Output Q13 of 15
Kubernetes - kubectl Essential Commands
Given the command kubectl logs mypod --tail=5, what will be the output?
AShows all logs except the last 5 lines from the pod named mypod
BShows the first 5 lines of logs from the pod named mypod
CShows the last 5 lines of logs from the pod named mypod
DShows logs only if the pod has more than 5 containers
Step-by-Step Solution
Solution:
  1. Step 1: Understand the --tail option

    The --tail=5 option limits the output to the last 5 lines of the logs.
  2. Step 2: Confirm it applies to the specified pod

    The command targets the pod named mypod, so logs shown are from that pod only.
  3. Final Answer:

    Shows the last 5 lines of logs from the pod named mypod -> Option C
  4. Quick Check:

    --tail = last lines [OK]
Quick Trick: --tail shows last lines, not first [OK]
Common Mistakes:
  • Thinking --tail shows first lines
  • Confusing pod logs with container logs
  • Assuming it filters by container count

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes