Lesson  in  CKA Mock Exam

Question 4: Inspect a Container with crictl

Create a Pod, find which node it landed on, then use crictl on that node to get the container ID and its logs.

In Namespace project-tiger create a Pod named tigers-reunite of image httpd:2-alpine with labels pod=container and container=pod. Find out on which node the Pod is scheduled. Ssh into that node and find the containerd container belonging to that Pod.

Using command crictl:

  • Write the ID of the container into /opt/course/17/pod-container.txt
  • Write the logs of the container into /opt/course/17/pod-container.log
Hint 1

kubectl get pod -o wide shows you the node without needing to describe anything. Once you're on that node, crictl has separate subcommands for listing pod sandboxes vs. listing containers — you want the one that lists containers, filtered by name or by the pod it belongs to.

Hint 2

Whatever you redirect into the .log file, check both of the container's output streams ended up in it — crictl logs doesn't necessarily put everything where you'd expect by default, and a plain single-stream redirect can silently leave you with an empty (but still "successful") file.