chaoskube icon indicating copy to clipboard operation
chaoskube copied to clipboard

[FEATURE] Kill only pods which do have more then 1 sibling replica

Open WolfspiritM opened this issue 3 years ago • 2 comments
trafficstars

We're using chaoskube to kill random pods and also to "balance" our cluster.

We have many microservices that are running with more then one replica however we have a few services that can only run with 1 replica. Our monitoring checks the health of the pods by calling their web endpoint and notify us if the service is down.

It would be nice if chaoskube can be configured to only kill pods that belong to a deploymen/ReplicaSet with more then one other pod. I couldn't find any way to configure that.

As a workaround for now we're going to set a label for that pods to prevent them from being killed.

WolfspiritM avatar May 18 '22 11:05 WolfspiritM

Good idea.

I think that could be added fairly easily here: https://github.com/linki/chaoskube/blob/d1b517de27a1b24cf427d6774f67924ff2aac3eb/chaoskube/chaoskube.go#L531 by adding something like

if len(pods) <= 1 {
  continue
}

But we would need to write a test case to confirm that.

linki avatar May 18 '22 16:05 linki

Hi 👋, created the PR for this. Would appreciate the feedback!

MustafaSaber avatar May 19 '23 19:05 MustafaSaber