commit 0f49a12f40c77afc6081a892d9a37434af3e9235 parent c959ffacc806d7ac91bf23e31dc705d4688e12f5 Author: pyratebeard <root@pyratebeard.net> Date: Tue, 14 May 2024 11:59:15 +0100 updates Diffstat:
M | virtualisation/kubernetes.md | | | 17 | +++++++++++++++++ |
1 file changed, 17 insertions(+), 0 deletions(-)
diff --git a/virtualisation/kubernetes.md b/virtualisation/kubernetes.md @@ -14,3 +14,20 @@ kubectl -n <namespace> get pods <pod_name> -o jsonpath='{.spec.containers[*].nam ``` kubectl exec -it pods/demo -- /bin/bash ``` + +* list all completed pods + +``` +kubectl get pod --field-selector=status.phase==Succeeded +``` + +* delete all completed pods +``` +kubectl delete pod --field-selector=status.phase==Succeeded +``` + +* delete all errored pods +``` +kubectl delete pod --field-selector=status.phase==Failed +``` +