k8s批量删除pod(批量删除资源)

1、获取要删除的资源

kubectl get po | grep Terminating

  

 

 

2、使用awk获取资源名称

kubectl get po | grep Terminating | awk '{print $1}'

强制批量删除 kubectl delete po  --force --grace-period=0 ` kubectl get po | grep Terminating | awk '{print $1}' `

  

 

 

3、批量删除资源(资源过滤命令使用符号``括起来)
     

kubectl delete po ` kubectl get po | grep Terminating | awk '{print $1}' `

  

 

 原文来自:https://blog.csdn.net/LONG_Yi_1994/article/details/120702032

posted on 2022-06-22 11:35  groby  阅读(488)  评论(0编辑  收藏  举报