virtualisation/kubernetes.md
... ...
@@ -14,3 +14,20 @@ kubectl -n <namespace> get pods <pod_name> -o jsonpath='{.spec.containers[*].nam
14 14
```
15 15
kubectl exec -it pods/demo -- /bin/bash
16 16
```
17
+
18
+* list all completed pods
19
+
20
+```
21
+kubectl get pod --field-selector=status.phase==Succeeded
22
+```
23
+
24
+* delete all completed pods
25
+```
26
+kubectl delete pod --field-selector=status.phase==Succeeded
27
+```
28
+
29
+* delete all errored pods
30
+```
31
+kubectl delete pod --field-selector=status.phase==Failed
32
+```
33
+