Helm 安装,Kubernetes - 如何等待 Pod 准备就绪? [英] Helm install, Kubernetes - how to wait for the pods to be ready?
问题描述
我正在创建 CI/CD 管道.
I am creating a CI/CD pipeline.
我运行 helm install --wait --timeout 300 ...
.但这并没有真正等待,只是在发布"状态为 DEPLOYED
时返回.
I run helm install --wait --timeout 300 ...
. But that doesn't really wait, just returns when the "release" status is DEPLOYED
.
然后我在 kubectl get pods --namespace default -l 'release=${TAG}' -o yaml
中看到一些可以使用的东西:
So then I see a few things in kubectl get pods --namespace default -l 'release=${TAG}' -o yaml
that could be used:
- kind: Pod
status:
conditions:
- lastProbeTime: null
lastTransitionTime: 2018-05-11T00:30:46Z
status: "True"
type: Initialized
- lastProbeTime: null
lastTransitionTime: 2018-05-11T00:30:48Z
status: "True"
type: Ready
所以我想我会看看什么时候 Ready
条件变为True".
So I guess I will look at when Ready
condition becomes "True".
感觉有点不对劲...每个人都解决了这个问题,所以我假设
kubectl
有一些特性,对吗?
这样查询合适吗?(请参阅 Kubernetes JSONPath 参考)
Is this the right thing to query? (See Kubernetes JSONPath reference)
kubectl get pods --namespace default -l 'release=sc8757070' -o jsonpath='{.items[*].status.conditions[?(@.type=="Ready")].status}'
kubectl get pods --namespace default -l 'release=sc8757070' -o jsonpath='{.items[*].status.conditions[?(@.type=="Ready")].status}'
推荐答案
你可以使用 kubectl rollout status
$ kubectl rollout status -h
Show the status of the rollout.
By default 'rollout status' will watch the status of the latest rollout until
it's done...
这篇关于Helm 安装,Kubernetes - 如何等待 Pod 准备就绪?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!