I'm trying to write a little shell script that is checking the log output of a long running Kubernetes Pod when the Pod is done.
The script shall wait for status "Completed" but the following command does not exit when the status is switching from "Running" to "Completed":
$ kubectl wait --for=condition=Completed --timeout=24h pod/longrunningpodname
^C
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
longrunningpodname 0/1 Completed 0 18h
I would also expect the command to return immediately if the Pod is already in the status. But that doesn't happen.
Is kubectl wait not the command I'm looking for?