我们对使用k3s和skaffold在本地部署(部署到CI构建代理)的应用程序进行了一些自动化测试。
运行skaffold deploy --status-check
时如何查看(stdout或文件)pod日志?
(在部署过程中,我们遇到了一些错误,除非我们使用ssh到构建代理程序,否则这些错误是看不到的。)
以下内容在成功部署后运行时会捕获日志,但是如果我们在运行skaffold deploy
之前运行它,这将不起作用,大概是因为它没有拾取运行后启动的任何Pod该命令:
kubectl logs \
--namespace x \
--follow \
--ignore-errors \
--max-log-requests 50 \
--all-containers \
--prefix \
--timestamps \
--selector release=y >"k8s.log" 2>&1 &
skaffold deploy --status-check
的输出
看起来像这样:
LAST DEPLOYED: Tue Oct 13 18:14:03 2020 NAMESPACE: smoke STATUS: deployed REVISION: 1 TEST SUITE: None Waiting for deployments to stabilize... - smoke:deployment/smoke-assets is ready. [7/8 deployment(s) still pending] - smoke:deployment/smoke-b is ready. [6/8 deployment(s) still pending] - smoke:deployment/smoke-c is ready. [5/8 deployment(s) still pending] - smoke:deployment/smoke-d: waiting for rollout to finish: 0 of 1 updated replicas are available... - smoke:deployment/smoke-e: waiting for rollout to finish: 0 of 1 updated replicas are available... - smoke:deployment/smoke-f: waiting for rollout to finish: 0 of 1 updated replicas are available... - smoke:deployment/smoke-g: waiting for rollout to finish: 0 of 1 updated replicas are available... - smoke:deployment/smoke-h: waiting for rollout to finish: 0 of 2 updated replicas are available... - smoke:deployment/smoke-d is ready. [4/8 deployment(s) still pending] - smoke:deployment/smoke-g is ready. [3/8 deployment(s) still pending] - smoke:deployment/smoke-e is ready. [2/8 deployment(s) still pending] - smoke:deployment/smoke-h: waiting for rollout to finish: 1 of 2 updated replicas are available... - smoke:deployment/smoke-h is ready. [1/8 deployment(s) still pending] 1/8 deployment(s) failed - smoke:deployment/smoke-f: running [kubectl --context k3d-smoke-tests-cluster rollout status deployment smoke-f --namespace smoke --watch=false] - stdout: "" - stderr: "error: deployment \"smoke-f\" exceeded its progress deadline\n" - cause: exit status 1 - smoke:deployment/smoke-f failed. Error: running [kubectl --context k3d-smoke-tests-cluster rollout status deployment smoke-f --namespace smoke --watch=false] - stdout: "" - stderr: "error: deployment \"smoke-f\" exceeded its progress deadline\n" - cause: exit status 1.
答案 0 :(得分:1)
答案 1 :(得分:0)
@Graham Russell --status-check
应该记录已失败的Pod。
我唯一能想到的就是Pod容器被终止并且在skaffold可以抓住日志之前被清理了。
当前无法在所有部署稳定之前将日志流传输到std。
您可以粘贴当前的status-check
输出