Delete all pods matching the egrep pattern (#13821)

* Delete all pods matching the egrep pattern

* replace egrep with awk to delete pods by a pattern

* Update content/en/docs/reference/kubectl/cheatsheet.md

Co-Authored-By: ismailyenigul <ismailyenigul@gmail.com>
This commit is contained in:
ismail yenigul 2019-04-25 21:29:49 +03:00 committed by Kubernetes Prow Robot
parent eaf7658f76
commit 100de28f11
1 changed files with 2 additions and 0 deletions

View File

@ -265,6 +265,8 @@ kubectl delete pod,service baz foo # Dele
kubectl delete pods,services -l name=myLabel # Delete pods and services with label name=myLabel
kubectl delete pods,services -l name=myLabel --include-uninitialized # Delete pods and services, including uninitialized ones, with label name=myLabel
kubectl -n my-ns delete po,svc --all # Delete all pods and services, including uninitialized ones, in namespace my-ns,
# Delete all pods matching the awk pattern1 or pattern2
kubectl get pods -n mynamespace --no-headers=true | awk '/pattern1|pattern2/{print $1}' | xargs kubectl delete -n mynamespace pod
```
## Interacting with running Pods