[cc lang=”bash”]
k8s批量删除POD命令
kubectl get pod -n kube-system | grep coredns | awk ‘{system(“kubectl delete pod “$1″ -n kube-system”)}’
kubectl get pods -o wide –all-namespaces |grep none |grep Evicted | awk ‘{system(“kubectl delete pod “$1″ -n kube-system”)}’
kubectl get pods | grep Evicted | awk ‘{print $1}’ | xargs kubectl delete pod
k8s批量删除POD脚本
#!/bin/bash
for pod in $(kubectl get pods|grep Evicted|awk ‘{print $1}’);
do
kubectl delete pods $pod
done
[/cc]