CKA 模拟真题 Killer.sh | 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
译文
在名称空间 project-tiger 中,创建一个名为 tigers-reunite 的Pod,镜像为 httpd:2.4.41-alpine ,标签为 pod=container ,container=pod 。找出Pod被安排在哪个节点上。Ssh进入该节点,找到属于该Pod的containerd容器。
使用 crictl 命令。
将容器的ID 和 info.runtimeType 写入 /opt/course/17/pod-container.txt 中。 将容器的日志写入 /opt/course/17/pod-container.log
解答
bash
kubectl config use-context k8s-c1-H |
创建pod
k -n project-tiger run tigers-reunite \ |
查看pod所在节点
bash
k -n project-tiger get pod tigers-reunite -o wide |
远程连接node
ssh cluster1-node2 |
写内容到文件
echo "6253a89688d7d io.containerd.runc.v2" > /opt/course/17/pod-container.txt |
ssh cluster1-node2 'crictl logs 6253a89688d7d' &> /opt/course/17/pod-container.log |



