Wait for pod to be ready

export POD_NAME=hello-d8d8d7455-j9nzw
while [[ $(oc get pods $POD_NAME -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}') != "True" ]]; do echo "waiting for pod" && sleep 1; done
  • If you want to wait until all the pods with a common label you can do:
while [[ $(kubectl get pods -l app=hello -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}') != "True" ]]; do echo "waiting for pod" && sleep 1; done
Previous
Next