Kubernetes头盔安装-如何等待吊舱准备就绪? [英] 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
条件变为真"时查看.
So I guess I will look at when Ready
condition becomes "True".
-
要做的事有点不对劲...每个人都解决了这个问题,所以我认为
kubectl
具有某些功能,对吗?
It feels a bit wrong thing to do... Everyone solves this so I assume there is some feature of
kubectl
for that, is there?
这是正确的查询对象吗? (请参见 Kubernetes JSONPath参考)
Is this the right thing to query? (See Kubernetes JSONPath reference)
kubectl获取容器--namespace默认-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...
这篇关于Kubernetes头盔安装-如何等待吊舱准备就绪?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!