[root@qz_k8s_m1 data]# kubectl get pod -n dev NAME READY STATUS RESTARTS AGE test-7b47f8cccb-cwdfw 1/1 Running 0 3h28m test-6c5bbd4f49-ns74j 0/1 Running 92 6h55m test-7c78fbdf68-cg28l 1/1 Running 0 8d
1 2 3 4 5 6 7 8 9 10 11
# 找出其中未就绪且重启次数大于10次的pod [root@qz_k8s_m1 data]# kubectl get pod -n dev | awk '($2=="0/1" && $4>10)' test-6c5bbd4f49-ns74j 0/1 Running 93 6h57m
# 可以只打印pod名字 [root@qz_k8s_m1 data]# kubectl get pod -n dev | awk '($2=="0/1" && $4>20) {print $1}' test-6c5bbd4f49-ns74j
# 不打印第一行 kubectl get deployment | awk 'NR>1 {print $1}'