I wanna use kubectl wait command to wait until a pvc is bound.
I tried kubectl wait --for=condition=bound pvc/my-pvc-claim --timeout=2s with a pvc which is already bound, but it doesn't seem to work. This is the output error: timed out waiting for the condition on persistentvolumeclaims/my-pvc-claim.
I read kubectl wait documentation, but still can't understand which condition I should use. How can I accomplish that? Is there a more complete documentation explaining how to do that?
You can use the following command:
while [[ $(kubectl get pvc myclaim -o 'jsonpath={..status.phase}') != "Bound" ]]; do echo "waiting for PVC status" && sleep 1; done
You may want to try using explain to see what conditions are possible to make sure you have the right one. Check here for an example of how you might use that.