I have k8s cluster with pods, deployments etc. I am using helm to deploy my app. I want to delete all deployment and using below command
helm delete myNamespace --purge
If I will look at status of my pods, I will see that there are in terminating state, problem is that it takes time. Is there any way to remove it like instantly with some force flag or somthing.
You can try the following command:
helm delete myNamespace --purge --no-hooks
Also, you can use kubectl to forcefully delete the pods, instead of waiting for termination.
Here's what I got from this link. https://kubernetes.io/docs/tasks/run-application/force-delete-stateful-set-pod/
If you want to delete a Pod forcibly using kubectl version >= 1.5, do the following:
kubectl delete pods <pod> --grace-period=0 --force
If you’re using any version of kubectl <= 1.4, you should omit the --force option and use:
kubectl delete pods <pod> --grace-period=0
If even after these commands the pod is stuck on Unknown state, use the following command to remove the pod from the cluster:
kubectl patch pod <pod> -p '{"metadata":{"finalizers":null}}'
Always perform force deletion of StatefulSet Pods carefully and with complete knowledge of the risks involved.