Aut*_*ner 22 kubernetes kubectl
我正在尝试通过本文档使用 kubectl wait 命令检查 pod 的状态。以下是我正在尝试的命令
kubectl wait --for=condition=complete --timeout=30s -n d1 job/test-job1-oo-9j9kj
Run Code Online (Sandbox Code Playgroud)
以下是我得到的错误
Kubectl error: status.conditions accessor error: Failure is of the type string, expected map[string]interface{}
Run Code Online (Sandbox Code Playgroud)
和我的kubectl -o json output can be accessed via this github 链接。
有人可以帮我解决这个问题吗
Noa*_*nos 17
要等到 pod 运行,请检查“condition=ready”。此外,更喜欢按标签过滤,而不是指定 pod id。例如:
$ kubectl wait --for=condition=ready pod -l app=netshoot
pod/netshoot-58785d5fc7-xt6fg condition met
Run Code Online (Sandbox Code Playgroud)
另一个选项是推出状态- 等到部署完成:
$ kubectl rollout status deployment netshoot
deployment "netshoot" successfully rolled out
Run Code Online (Sandbox Code Playgroud)
当需要等待安装应用程序时,这两个选项在自动化脚本中都非常有效。但是,正如@CallMeLaNN 在第二个选项中指出的那样,“推出”部署不一定没有错误。
Ric*_*ico 14
这完全看起来像是您在输出中描述kubectl wait --for=condition=complete的Pod而不是Job 上运行。
Pod 没有这个--for=condition=complete选项。确切地说,当我在 pod 上运行它时,我得到了什么:
$ kubectl wait --for=condition=complete pod/mypod-xxxxxxxxxx-xxxxx
error: .status.conditions accessor error: Failure is of the type string, expected map[string]interface{}
Run Code Online (Sandbox Code Playgroud)
正如 Rico 所概述的,您不能等待 Pod 上的完整状态,假设您想等待作业完成,请使用以下命令
kubectl wait --for=condition=complete --timeout=30s -n d1 job/test-job1
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
29435 次 |
| 最近记录: |