简体   繁体   English

等待Kubernetes或Google Container Engine中的作业/ pod完成

[英]Wait for job/pod completion in Kubernetes or Google Container Engine

What's the best way in script to wait for a job or pod to complete in Kubernetes or Google Container Engine? 在Kubernetes或Google Container Engine中等待作业或pod完成的最佳方法是什么?

In particular, it would be better to be notified rather than polling for status in kubectl , but I'd be happy with a fairly efficient loop without any slips between the cracks. 特别是,最好是通知而不是轮询kubectl状态,但我会对一个相当有效的循环感到满意,而且裂缝之间没有任何滑动。 Essentially, I'd like the equivalent of a plain docker run since that blocks until command termination, but I don't want to use docker directly in this case. 从本质上讲,我喜欢相当于普通的docker run因为阻塞直到命令终止,但在这种情况下我不想直接使用docker。

I looked at Github Issue #1899 but it looks unresolved as yet. 我看了Github问题#1899,但它看起来尚未解决。

It's not really what it was designed for, but you could run kubectl attach $POD . 这不是它的设计目的,但你可以运行kubectl attach $POD It'll show you the output of the pod while it's running and automatically terminate once the pod is done running. 它会在它运行时显示pod的输出,并在pod运行完毕后自动终止。

Of course, you'll have to handle the error that it prints if the pod is already done running, since it's only really meant for use on pods that are currently running. 当然,如果pod已经完成运行,你将不得不处理它打印的错误,因为它只适用于当前正在运行的pod。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 用于 Google 容器引擎部署的 Docker 和 Kubernetes 上的对称 - symmetricds on Docker and Kubernetes for Google Container Engine Deployment 如何更新Google Container Engine上的Kubernetes部署? - How to update a Kubernetes deployment on Google Container Engine? 是否可以在Google Kubernetes Engine上安装短暂的磁盘上存储? - Is it possible to have ephemeral, on-disk pod storage on Google Kubernetes Engine? Google容器引擎:Kubernetes在创建容器后不会暴露外部IP - Google Container Engine: Kubernetes is not exposing external IP after creating container Kube.netes:在多容器 Pod/Job 中停止 CloudSQL-proxy sidecar 容器 - Kubernetes: stop CloudSQL-proxy sidecar container in multi container Pod/Job Kubernetes Pod没有将卷绑定到容器 - Kubernetes pod not binding volumes to container Kubernetes部署,Pod和容器概念 - Kubernetes Deployments, Pod and Container concepts 如何使用kubernetes将Rails应用程序部署到Google容器引擎? - How to deploy a rails app to google container engine with kubernetes? 服务主机/端口未定义,Kubernetes / Google容器引擎 - Service host/port undefined, Kubernetes/Google Container Engine 通过Jenkins作业从在kubernetes pod中运行的docker容器中运行bash脚本 - Run a bash script from a docker container running in kubernetes pod via Jenkins job
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM