Pod deletion policy when scaling down the deployment?

8/22/2018

Is there a way to tell k8s to delete the oldest pods in the deployment first?

For instance I have a deployment which consist of 3 pods. I then decided to scale it up by adding 3 more pods:

kubectl scale deployment some-deployment --replicas=6

After finishing my tests I want it to be 3 pods again, so I scale it down:

kubectl scale deployment some-deployment --replicas=3

Is there a way to configure deployment in a way so that during the scale down process the oldest pods would be removed first? What if I need it the other way around, delete more recent pods first?

-- NarūnasK
deployment
kubectl
kubernetes

1 Answer

8/23/2018

This is an open issue. You may find this related item interesting. Currently you are not able to do it. Let's hope it will be fixed soon.

-- VKR
Source: StackOverflow