告诉作业何时完成 [英] Tell when Job is Complete
本文介绍了告诉作业何时完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在寻找一种方法来告诉(从脚本中)Kubernetes 作业何时完成.然后我想从容器中取出日志并进行清理.
I'm looking for a way to tell (from within a script) when a Kubernetes Job has completed. I want to then get the logs out of the containers and perform cleanup.
这样做的好方法是什么?最好的方法是运行 kubectl describe job
和 grep for 1 Succeeded
或类似的东西?
What would be a good way to do this? Would the best way be to run kubectl describe job <job_name>
and grep for 1 Succeeded
or something of the sort?
推荐答案
从 1.11 版本开始,您可以:
Since version 1.11, you can do:
kubectl wait --for=condition=complete job/myjob
您还可以设置超时:
kubectl wait --for=condition=complete --timeout=30s job/myjob
这篇关于告诉作业何时完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文