K8S 组合命令

强制删除namespace

kubectl get namespace [namespace-name] -o json | tr -d "\n" | sed "s/\"finalizers\": \[[^]]\+\]/\"finalizers\": []/" | kubectl replace --raw /api/v1/namespaces/[namespace-name]/finalize -f -

批量删除资源调度产生的Evicted pod

kubectl get pod -A | grep 'Evicted' | awk '{print $2" -n "$1}' | xargs kubectl delete pod
posted @ 2022-09-14 18:20  兰嘉轩  阅读(52)  评论(0编辑  收藏  举报