How to wait for a Kubernetes pod to be ready — one liner
1 min readMar 29, 2019
By pod name:
while [[ $(kubectl get pods hello-d8d8d7455-j9nzw -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}') != "True" ]]; do echo "waiting for pod" && sleep 1; done
By label (deployment):
while [[ $(kubectl get pods -l app=hello -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}') != "True" ]]; do echo "waiting for pod" && sleep 1; done
If your pod is in another namespace (not default), use:
kubectl -n <your-namespace>...