Kubernetes CKA sample exam question 65 with answer

Question
In Namespace project-tiger create a Pod named tigers-reunite of image httpd:2.4.41-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:

  1. Write the ID of the container and the info.runtimeType into /opt/course/17/pod-container.txt
  2. Write the logs of the container into /opt/course/pod-container.log

Answer
Run the pod:
kubectl -n project-tiger run tigers-reunite --image=httpd:2.4.41-alpine --labels=pod=container,container=pod
Get where the pod is scheduled:
kubectl -n project-tiger get po tigers-reunite -o wide
SSH to that node:
ssh cluster1-worker1
Get the Pod ID:
crictl pods --label pod=container
From the output, grab the ID and use it to get container ID:
crictl ps | grep xxxxxxx # grep by Pod ID
Using container ID - inspect the container and grep for runtime to get info.runtimeType:
crictl inspect yyyyyyyy |grep runtime # yyyyyyyy is the container ID
Get the logs:
sudo crictl logs yyyyyyyy # yyyyyyyy is the container ID
and save them on master node on /opt/course/pod-container.log.
Write /opt/course/17/pod-container.txt on master node:
yyyyyyyy io.containerd.runtime.v1.linux