modified: README.md

This commit is contained in:
Márcio Fernandes committed 2026-09-20 22:31:22 +00:00
1 parent 060ea17354
commit 9168ab5581
1 file changed
+8 -4
+8 -4
View File
@@ -10,7 +10,7 @@ Kubernetes is an open‑source platform that automates the deployment, scaling,
- [Create an pod](#create-an-pod)
- [Get Pod](#get-pod)
- [delete Pod](#delete-pod)
- [delete all Failed pods](#delete-all-failed-pods)
- [Failed pods](#failed-pods)
- [delete all pods with prefix](#delete-all-pods-with-prefix)
- [OOMKilled](#oomkilled)
- [Attach to an pod](#attach-to-an-pod)
@@ -254,23 +254,27 @@ echo $POD_NAME
kubectl delete pod -n appNamespace -l app=myAppName
```
### delete all Failed pods
### Failed pods
List all.
``` bash
kubectl get pods --all-namespaces --field-selector=status.phase=Failed --no-headers | wc -l
```
Delete
``` bash
count=0
while true; do
pods=$(kubectl get pods --all-namespaces --field-selector=status.phase=Failed \
-o jsonpath='{range .items[*]}{.metadata.namespace}{" "}{.metadata.name}{"\n"}{end}' \
| head -n 100)
| head -n 500)
[ -z "$pods" ] && break
echo "Batch $((++count)): deleting up to 100 pods"
echo "Batch $((++count)): deleting up to 500 pods"
while read ns name; do
kubectl delete pod "$name" -n "$ns"