-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
10 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
#!/bin/sh | ||
|
||
#!/bin/bash | ||
|
||
kubectl get pod -A --field-selector status.phase=Failed | ||
CONTEXT=ceph-k8s | ||
|
||
|
||
|
||
kubectl --context $CONTEXT get pod -A --field-selector status.phase=Failed | ||
|
||
kubectl delete pods -A --field-selector status.phase=Failed | ||
kubectl --context $CONTEXT delete pods -A --field-selector status.phase=Failed | ||
|
||
for ns in $(kubectl get po -A --no-headers | grep -v Running | awk {'print $1'}); do | ||
delpods=$(kubectl get pods --no-headers -n $ns | grep -E 'Evicted|Completed|ErrImagePull|Failed' | awk '{print $1 }') | ||
for ns in $(kubectl --context $CONTEXT get po -A --no-headers | grep -v Running | awk {'print $1'}); do | ||
delpods=$(kubectl --context $CONTEXT get pods --no-headers -n $ns | grep -E 'Evicted|Completed|ErrImagePull|Failed' | awk '{print $1 }') | ||
echo delpods=$delpods | ||
for i in $delpods; do | ||
echo deleting $ns/$i | ||
# kubectl delete pod $i --force=true --wait=false --grace-period=0 -n $ns | ||
kubectl delete pod $i -n $ns | ||
# kubectl --context $CONTEXT delete pod $i --force=true --wait=false --grace-period=0 -n $ns | ||
kubectl --context $CONTEXT delete pod $i -n $ns | ||
done | ||
done |