Terminate k8s pods faster

5/31/2019

I have a simple Node.js server running on some Kubernetes pods. When I delete a deployment with:

kubectl delete deployment <deployment-name>

sometimes pods have a status of terminating for 5-8 seconds. Seems excessive - is there a way to kill them faster somehow?

-- Alexander Mills
kubernetes

1 Answer

5/31/2019

If you really want to kill them instead of gracefully shutdown, then:

kubectl delete deployment <deployment-name> --grace-period=0

Also, if you have any preStop handlers configured, you could investigate if they are causing any unnecessary delay.

-- JamesJJ
Source: StackOverflow