Monday, April 9, 2018

force delete a pod in openshift (kubernetes)


For kubernetes:

kubectl delete pod --grace-period=0 --force --namespace <NAMESPACE> <PODNAME>


and for openshift

oc delete pod --grace-period=0 --force --namespace <NAMESPACE> <PODNAME>


output: 
warning: Immediate deletion does not wait for confirmation that the running resource has been terminated. The resource may continue to run on the cluster indefinitely.


This command may be use for deleting pods whose status is Unknown.
As the output says, the pod may still be running. 

--

To delete all pods in a namespace:
//In this example namespace in 'default'
kubectl delete pods --all  -n  default

To delete all svc in a namespace:
//In this example namespace in 'default'
kubectl delete svc --all  -n  default

--
 

No comments:

Post a Comment