题干
For this question, please set this context (In exam, diff cluster name)
kubectl config use-context kubernetes-admin@kubernetes
application-pod pod is running, save All ERROR's pod logs only in poderrorlogs.txt
application-pod pod
正在运行,将所有ERROR的pod日志保存在poderrorlogs.txt中
解题思路
- 切换K8S集群环境
kubectl config use-context kubernetes-admin@kubernetes
- 通过
kubectl logs
命令查看日志,并过滤错误写入到指定文件中
kubectl logs application-pod | grep ERROR > poderrorlogs.txt