[英]How to tell if nodes are deleted in bash?
while true; do
kubectl get nodes -o wide
if [ $? -ne 0 ]; then
echo "Nodegroup deleted successfully"
break
fi
done
在此循環之前,我正在運行刪除節點組命令,刪除需要一些時間。 在 kubectl 命令返回“未找到資源”后,如何從循環中跳出?
或者,您可以嘗試獲取可用節點數並將其存儲在變量中。 現在因為我們有計數在每個節點刪除后遞減它並且在 while 條件下你可以檢查 count.= 0。
while [[count != 0]]; do
Command for deleting node
((count --))
done
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.