Kubernetes头盔安装-如何等待吊舱准备就绪? [英] Helm install, Kubernetes - how to wait for the pods to be ready?

查看:54
本文介绍了Kubernetes头盔安装-如何等待吊舱准备就绪?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建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".

  1. 要做的事有点不对劲...每个人都解决了这个问题,所以我认为kubectl具有某些功能,对吗?

  1. 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆