From 100de28f11ef634921376a9a1583506875a7802d Mon Sep 17 00:00:00 2001 From: ismail yenigul Date: Thu, 25 Apr 2019 21:29:49 +0300 Subject: [PATCH] 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 --- content/en/docs/reference/kubectl/cheatsheet.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/content/en/docs/reference/kubectl/cheatsheet.md b/content/en/docs/reference/kubectl/cheatsheet.md index 06ef0ea73c..9be0d4b541 100644 --- a/content/en/docs/reference/kubectl/cheatsheet.md +++ b/content/en/docs/reference/kubectl/cheatsheet.md @@ -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