Skip to main content

Question 17 - Find Container of Pod

Question 17 | Find Container of Pod and check info

Use context: kubectl config use-context k8s-c1-H

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:

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

k run tigers-reunite  -n project-tiger --image=httpd:2.4.41-alpine --labels "pod=container,container=pod"
kubectl get pods -n project-tiger -o wide

# Check which node receives it and enter that node
ssh cluster1-node2
# To get the id
crictl ps | grep tigers-reunite
b01edbe6f89ed
# Do an inspect looking for runtimeType
crictl inspect b01edbe6f89ed | grep runtimetype
runtimeType": "io.containerd.runc.v2"

echo "b01edbe6f89ed io.containerd.runc.v2" > /opt/course/17/pod-container.txt