kubectl delete pod code example

Example 1: kubectl delete all pods

kubectl delete --all pods

Example 2: kubectl delete pods

kubectl delete pod podname

Example 3: force delete pod kubernetes

kubectl delete pods  --grace-period=0 --force

Example 4: kubectl restart deployment

kubectl rollout restart deployment yourDeploymentName

Example 5: kubectl logs with grep

kubectl log bino | grep "error unable-to-access-website" >> John/Doe/Bino/log.txt

Example 6: kubectl delete pods wildcard

$ kubectl get pods -n default --no-headers=true | awk '/web-app/{print $1}'| xargs  kubectl delete -n default podpod "web-app-7fb4f5bff9-8crgx" deletedpod "web-app-7fb4f5bff9-ftzfd" deletedpod "web-app-7fb4f5bff9-rrkt2" deleted

Tags:

Misc Example