kubernetes - kubectl 等待 --for=condition=complete --timeout=30s
问题描述
我正在尝试通过此文档使用 kubectl wait 命令检查 pod 的状态。以下是我正在尝试的命令
kubectl wait --for=condition=complete --timeout=30s -n d1 job/test-job1-oo-9j9kj
以下是我得到的错误
Kubectl error: status.conditions accessor error: Failure is of the type string, expected map[string]interface{}
和我的kubectl -o json output can be accessed via this github
链接。
有人可以帮我解决问题吗
解决方案
要等到您的 pod 运行,请检查“condition=ready”。另外,更喜欢按标签过滤,而不是指定 pod id。例如:
$ kubectl wait --for=condition=ready pod -l app=netshoot
pod/netshoot-58785d5fc7-xt6fg condition met
另一个选项是推出状态- 等到部署完成:
$ kubectl rollout status deployment netshoot
deployment "netshoot" successfully rolled out
当需要等待安装应用程序时,这两个选项在自动化脚本中都非常有效。但是,正如@CallMeLaNN 为第二个选项所指出的那样,部署“推出”不一定没有错误。
推荐阅读
- r - 使用 grep 函数在 R 中正确转换数据
- python - 如何打印到文本文件?
- hyperlink - 如何使用 JS 渲染函数在同一列中有多个超链接?
- yarnpkg - 运行纱线添加
运行 yarn install 后重新链接所有依赖项 - go - 有效地跳过 Stripe API 调用和/或记录测试 ID
- angular - 角度组件未收到可观察的
- regex - 如何将转义组符号 {&date:dd.\{mm\}.yyyy} 而不是 {&date:dd.{mm}.yyyy} 与 vba 和正则表达式匹配
- android - 拒绝对先前失败的类 java.lang.Class 重新初始化
- angular - 刷新页面后Ag网格行选择丢失
- sql-server - SQL Server 累积分组