头盔安装,Kubernetes-如何等待吊舱准备就绪?

Ond*_*žka 5 kubernetes kubernetes-helm

我正在创建CI / CD管道。

我跑helm install --wait --timeout 300 ...。但这并没有真正等待,仅在“发布”状态为时返回DEPLOYED

因此,我看到 kubectl get pods --namespace default -l 'release=${TAG}' -o yaml其中可以使用的一些方法:

- 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
Run Code Online (Sandbox Code Playgroud)

所以我想我会看看当Ready条件变为“ True”时。

  1. 感觉有点不对劲...每个人都解决了这个问题,所以我认为它具有某些功能kubectl,是否存在?

  2. 这是正确的查询吗?(参见Kubernetes JSONPath参考

    kubectl get pods --namespace default -l'release = sc8757070'-o jsonpath ='{。items [*]。status.conditions [?(@。type ==“ Ready”)]。status}'

Ami*_*pta 8

你可以用 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...
Run Code Online (Sandbox Code Playgroud)


Eug*_*kin 5

有一个很好的选项-n | --namespace NAMESPACE允许等待不同命名空间中的部署,例如kube-system

kubectl rollout status deployment tiller-deploy -n kube-system
Run Code Online (Sandbox Code Playgroud)