Part5 故障排除

14. 保存错误日志 (5%)

Task

Monitor the logs of pod foobar and:

  • Extract log lines corresponding to error

    unable-to-access-website

  • Write them to /opt/KUTR00101/foobar

中文解释:

监控名为 foobar 的 Pod 的日志,并过滤出具有 unable-to-access-website 信息的行,然后将其写入到 /opt/KUTR00101/foobar

解题:

kubectl logs foobar | grep "unable-to-access-website" > /opt/KUTR00101/foobar

cat /opt/KUTR00101/foobar

15. sidecar 容器 (7%)

kubernetes's built-in logging architecture (e.g. kubectl logs). Adding a streaming sidecar container is a good and common way to accomplish this requirement.

Task

Add a busybox sidecar container to the existing Pod big-corp-app . The new sidecar container has to run the following command:

/bin/sh -c tail -n+1 /var/log/big-corp-app.log

Use a volume mount named logs to make the file /var/log/big-corp-app.log available to the sidecar container.

Don't modify the existing container.

Don't modify the path of the log file, both containers must access it at /var/log/big-corp-app.log .

解题:

16. 监控 Pod 度量指标 (5%)

Task

From the pod label name=cpu-user , find pods running high CPU workloads and write the name of the pod consuming most CPU to the file /opt/KUTR00401/KUTR00401.txt (which already exists).

中文解释:

找出具有标签 name=cpu-user 的 Pod,并过滤出使用 CPU 最高的 Pod,然后把它的名字写入已经存在的文件 /opt/KUTR00401/KUTR00401.txt 里

解题:

17. 集群故障排查 (13%)

Task

A kubernetes worker node named wk8s-node-0 is in state NotReady . Investigate why this is the case, and perform any appropriate steps to bring the node to a Ready state, ensuring that any changes are made permanent.

You can ssh to the failed node using:

ssh wk8s-node-0

You can assume elevated privileges on the node with the following command:

sudo -i

解题:

Last updated