对于测试,我希望有一种方法可以等到部署(副本:0)真正消失。
部署状态似乎并未等待所有 Pod 实际终止。
所以我想知道等待部署终止的惯用方法是什么。 换句话说,我希望在 Kubernetes 中同步删除资源,并且只有在所有拥有的资源(递归地)被删除后才返回。
最佳答案
我认为 Kubernetes 1.11+ 在删除返回之前已经等待删除完成:
kubectl delete --help | grep '\-\-wait'
--wait=true: If true, wait for resources to be gone before returning. This waits for finalizers.
即便如此,您也可以使用kubectl wait
等待资源删除:
Wait for a specific condition on one or many resources. Alternatively, the command can wait for the given set of resources to be deleted by providing the "delete" keyword as the value to the
--for
flag.
例如:kubectl等待部署/my-deployment --for=delete
关于kubernetes - 等待 Deployment 真正缩小规模的惯用方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59950237/