Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

kubectl wait until pod is gone (Terminating)

I know I can use kubectl wait to check if a pod is Ready but is there an easy way to check whether the pod is gone or in Terminating state? I'm running some tests and I only want to continue when the pod (or the namespace for that matter) is completely gone.

Also a timeout option would come in handy.

like image 674
Sam Avatar asked Oct 29 '25 21:10

Sam


1 Answers

It's actually part of the wait command.

kubectl wait --for=delete pod/busybox1 --timeout=60s

You can check with kubectl wait --help to see this example and some more. For example

--for='': The condition to wait on: [delete|condition=condition- name|jsonpath='{JSONPath expression}'=JSONPath Condition]. The default status value of condition-name is true, you > can set false with condition=condition-name=false.

like image 78
The Fool Avatar answered Oct 31 '25 10:10

The Fool



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!