Helm install, Kubernetes - how to wait for the pods to be ready?

5/11/2018

I am creating a CI/CD pipeline.

I run helm install --wait --timeout 300 .... But that doesn't really wait, just returns when the "release" status is DEPLOYED.

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

So I guess I will look at when Ready condition becomes "True".

  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?

  2. 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}'

-- Ondra Žižka
kubernetes
kubernetes-helm

2 Answers

5/13/2019

There is a good option -n | --namespace NAMESPACE that allow to wait deployments in different namespaces, for example in kube-system:

kubectl rollout status deployment tiller-deploy -n kube-system
-- Eugene Lopatkin
Source: StackOverflow

5/11/2018

You could use 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...
-- Amit Kumar Gupta
Source: StackOverflow