Kubernetes: How to gracefully delete pods in daemonset?

10/18/2018

If there is an update in the docker image, rolling update strategy will update all the pods one by one in a daemonset, similarly is it possible to restart the pods gracefully without any changes the daemonset config or can it be triggered explicitly?

Currently, I am doing it manually by

kubectl delete pod <pod-name> One by one until each pod gets into running state.

-- zillani
kubernetes

1 Answer

10/18/2018

You could try and use Node maintenance operations:

Use kubectl drain to gracefully terminate all pods on the node while marking the node as unschedulable (with --ignore-daemonsets, from Konstantin Vustin's comment):

kubectl drain $NODENAME --ignore-daemonsets

This keeps new pods from landing on the node while you are trying to get them off.

Then:

Make the node schedulable again:

kubectl uncordon $NODENAME
-- VonC
Source: StackOverflow